Jelajahi Sumber

feat:投诉类型和投诉记录模块功能完善

caoliqin 2 hari lalu
induk
melakukan
896aa1a408
16 mengubah file dengan 364 tambahan dan 82 penghapusan
  1. 15 8
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintRecordController.java
  2. 2 4
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintTypeController.java
  3. 14 0
      fs-service/src/main/java/com/fs/course/domain/FsUserCourseComplaintRecord.java
  4. 2 11
      fs-service/src/main/java/com/fs/course/domain/FsUserCourseComplaintType.java
  5. 15 7
      fs-service/src/main/java/com/fs/course/mapper/FsUserCourseComplaintRecordMapper.java
  6. 24 0
      fs-service/src/main/java/com/fs/course/param/UserCourseComplaintRecordParam.java
  7. 18 8
      fs-service/src/main/java/com/fs/course/service/IFsUserCourseComplaintRecordService.java
  8. 15 7
      fs-service/src/main/java/com/fs/course/service/IFsUserCourseComplaintTypeService.java
  9. 20 10
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseComplaintRecordServiceImpl.java
  10. 49 9
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseComplaintTypeServiceImpl.java
  11. 46 0
      fs-service/src/main/java/com/fs/course/vo/FsUserCourseComplaintRecordPageListVO.java
  12. 27 0
      fs-service/src/main/java/com/fs/course/vo/FsUserCourseComplaintTypeListVO.java
  13. 34 0
      fs-service/src/main/resources/db/20250605-初始化表结构.sql
  14. 28 6
      fs-service/src/main/resources/mapper/course/FsUserCourseComplaintRecordMapper.xml
  15. 7 12
      fs-service/src/main/resources/mapper/course/FsUserCourseComplaintTypeMapper.xml
  16. 48 0
      fs-user-app/src/main/java/com/fs/app/controller/UserCourseComplaintController.java

+ 15 - 8
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintRecordController.java

@@ -1,6 +1,11 @@
 package com.fs.course.controller;
 
 import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.course.vo.FsUserCourseComplaintRecordPageListVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -22,7 +27,7 @@ import com.fs.common.core.page.TableDataInfo;
 
 /**
  * 看课投诉记录Controller
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
@@ -38,11 +43,13 @@ public class FsUserCourseComplaintRecordController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:userCourseComplaintRecord:list')")
     @GetMapping("/list")
-    public TableDataInfo list(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
+    public R list(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
     {
-        startPage();
-        List<FsUserCourseComplaintRecord> list = fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordList(fsUserCourseComplaintRecord);
-        return getDataTable(list);
+//        startPage();
+        PageHelper.startPage(fsUserCourseComplaintRecord.getPageNum(), fsUserCourseComplaintRecord.getPageSize());
+        List<FsUserCourseComplaintRecordPageListVO> list = fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordList(fsUserCourseComplaintRecord);
+        PageInfo<FsUserCourseComplaintRecordPageListVO> pageInfo = new PageInfo<>(list);
+        return R.ok().put("rows", pageInfo);
     }
 
     /**
@@ -53,9 +60,9 @@ public class FsUserCourseComplaintRecordController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
     {
-        List<FsUserCourseComplaintRecord> list = fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordList(fsUserCourseComplaintRecord);
-        ExcelUtil<FsUserCourseComplaintRecord> util = new ExcelUtil<FsUserCourseComplaintRecord>(FsUserCourseComplaintRecord.class);
-        return util.exportExcel(list, "看课投诉记录数据");
+        List<FsUserCourseComplaintRecordPageListVO> list = fsUserCourseComplaintRecordService.selectFsUserCourseComplaintRecordList(fsUserCourseComplaintRecord);
+        ExcelUtil<FsUserCourseComplaintRecordPageListVO> util = new ExcelUtil<>(FsUserCourseComplaintRecordPageListVO.class);
+        return util.exportExcel(list, "看课投诉记录");
     }
 
     /**

+ 2 - 4
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseComplaintTypeController.java

@@ -18,7 +18,6 @@ import com.fs.common.enums.BusinessType;
 import com.fs.course.domain.FsUserCourseComplaintType;
 import com.fs.course.service.IFsUserCourseComplaintTypeService;
 import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.common.core.page.TableDataInfo;
 
 /**
  * 看课投诉类型Controller
@@ -38,11 +37,10 @@ public class FsUserCourseComplaintTypeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:list')")
     @GetMapping("/list")
-    public TableDataInfo list(FsUserCourseComplaintType fsUserCourseComplaintType)
+    public AjaxResult list(FsUserCourseComplaintType fsUserCourseComplaintType)
     {
-        startPage();
         List<FsUserCourseComplaintType> list = fsUserCourseComplaintTypeService.selectFsUserCourseComplaintTypeList(fsUserCourseComplaintType);
-        return getDataTable(list);
+        return AjaxResult.success(list);
     }
 
     /**

+ 14 - 0
fs-service/src/main/java/com/fs/course/domain/FsUserCourseComplaintRecord.java

@@ -1,6 +1,8 @@
 package com.fs.course.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.common.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.EqualsAndHashCode;
@@ -15,6 +17,18 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class FsUserCourseComplaintRecord extends BaseEntity{
 
+    @ApiModelProperty(value = "页码,默认为1", required = true)
+    @TableField(exist = false)
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10", required = true)
+    @TableField(exist = false)
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "用户昵称")
+    @TableField(exist = false)
+    private String nickName;
+
     /** 投诉记录id */
     private Long recordId;
 

+ 2 - 11
fs-service/src/main/java/com/fs/course/domain/FsUserCourseComplaintType.java

@@ -1,8 +1,8 @@
 package com.fs.course.domain;
 
 import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.TreeEntity;
 import lombok.Data;
-import com.fs.common.core.domain.BaseEntity;
 import lombok.EqualsAndHashCode;
 
 /**
@@ -13,15 +13,11 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class FsUserCourseComplaintType extends BaseEntity{
+public class FsUserCourseComplaintType extends TreeEntity{
 
     /** 投诉类型id */
     private Long complaintTypeId;
 
-    /** 父id,关联主键id */
-    @Excel(name = "父id,关联主键id")
-    private Long parentId;
-
     /** 投诉类型名称 */
     @Excel(name = "投诉类型名称")
     private String complaintTypeName;
@@ -30,9 +26,4 @@ public class FsUserCourseComplaintType extends BaseEntity{
     @Excel(name = "级别", readConverterExp = "目=前只有两级")
     private Integer typeLevel;
 
-    /** 是否删除,1-是,0-否 */
-    @Excel(name = "是否删除,1-是,0-否")
-    private Integer isDel;
-
-
 }

+ 15 - 7
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseComplaintRecordMapper.java

@@ -3,17 +3,18 @@ package com.fs.course.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.course.domain.FsUserCourseComplaintRecord;
+import com.fs.course.vo.FsUserCourseComplaintRecordPageListVO;
 
 /**
  * 看课投诉记录Mapper接口
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
 public interface FsUserCourseComplaintRecordMapper extends BaseMapper<FsUserCourseComplaintRecord>{
     /**
      * 查询看课投诉记录
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 看课投诉记录
      */
@@ -21,15 +22,22 @@ public interface FsUserCourseComplaintRecordMapper extends BaseMapper<FsUserCour
 
     /**
      * 查询看课投诉记录列表
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 看课投诉记录集合
      */
     List<FsUserCourseComplaintRecord> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord);
 
+    /**
+     * 查询看课分页列表
+     * @param fsUserCourseComplaintRecord 记录
+     * @return list
+     */
+    List<FsUserCourseComplaintRecordPageListVO> selectFsUserCourseComplaintRecordPageList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord);
+
     /**
      * 新增看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -37,7 +45,7 @@ public interface FsUserCourseComplaintRecordMapper extends BaseMapper<FsUserCour
 
     /**
      * 修改看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -45,7 +53,7 @@ public interface FsUserCourseComplaintRecordMapper extends BaseMapper<FsUserCour
 
     /**
      * 删除看课投诉记录
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 结果
      */
@@ -53,7 +61,7 @@ public interface FsUserCourseComplaintRecordMapper extends BaseMapper<FsUserCour
 
     /**
      * 批量删除看课投诉记录
-     * 
+     *
      * @param recordIds 需要删除的数据主键集合
      * @return 结果
      */

+ 24 - 0
fs-service/src/main/java/com/fs/course/param/UserCourseComplaintRecordParam.java

@@ -0,0 +1,24 @@
+package com.fs.course.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class UserCourseComplaintRecordParam {
+
+    @ApiModelProperty(value = "用户id,不传")
+    private Long userId;
+
+    @ApiModelProperty(value = "投诉类型id")
+    private Long complaintTypeId;
+
+    @ApiModelProperty(value = "投诉内容(暂时没有,只是保留这个字段)")
+    private String complaintContent;
+
+    @ApiModelProperty(value = "课程id")
+    private Long courseId;
+
+    @ApiModelProperty(value = "视频小节id")
+    private Long videoId;
+
+}

+ 18 - 8
fs-service/src/main/java/com/fs/course/service/IFsUserCourseComplaintRecordService.java

@@ -3,17 +3,19 @@ package com.fs.course.service;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.course.domain.FsUserCourseComplaintRecord;
+import com.fs.course.param.UserCourseComplaintRecordParam;
+import com.fs.course.vo.FsUserCourseComplaintRecordPageListVO;
 
 /**
  * 看课投诉记录Service接口
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
 public interface IFsUserCourseComplaintRecordService extends IService<FsUserCourseComplaintRecord>{
     /**
      * 查询看课投诉记录
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 看课投诉记录
      */
@@ -21,15 +23,15 @@ public interface IFsUserCourseComplaintRecordService extends IService<FsUserCour
 
     /**
      * 查询看课投诉记录列表
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 看课投诉记录集合
      */
-    List<FsUserCourseComplaintRecord> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord);
+    List<FsUserCourseComplaintRecordPageListVO> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord);
 
     /**
      * 新增看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface IFsUserCourseComplaintRecordService extends IService<FsUserCour
 
     /**
      * 修改看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface IFsUserCourseComplaintRecordService extends IService<FsUserCour
 
     /**
      * 批量删除看课投诉记录
-     * 
+     *
      * @param recordIds 需要删除的看课投诉记录主键集合
      * @return 结果
      */
@@ -53,9 +55,17 @@ public interface IFsUserCourseComplaintRecordService extends IService<FsUserCour
 
     /**
      * 删除看课投诉记录信息
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 结果
      */
     int deleteFsUserCourseComplaintRecordByRecordId(Long recordId);
+
+    /**
+     * 提交投诉记录
+     * @param userCourseComplaintRecordParam 入参
+     * @return int
+     */
+    int submitRecord(UserCourseComplaintRecordParam userCourseComplaintRecordParam);
+
 }

+ 15 - 7
fs-service/src/main/java/com/fs/course/service/IFsUserCourseComplaintTypeService.java

@@ -3,17 +3,18 @@ package com.fs.course.service;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.course.domain.FsUserCourseComplaintType;
+import com.fs.course.vo.FsUserCourseComplaintTypeListVO;
 
 /**
  * 看课投诉类型Service接口
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
 public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourseComplaintType>{
     /**
      * 查询看课投诉类型
-     * 
+     *
      * @param complaintTypeId 看课投诉类型主键
      * @return 看课投诉类型
      */
@@ -21,7 +22,7 @@ public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourse
 
     /**
      * 查询看课投诉类型列表
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 看课投诉类型集合
      */
@@ -29,7 +30,7 @@ public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourse
 
     /**
      * 新增看课投诉类型
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourse
 
     /**
      * 修改看课投诉类型
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourse
 
     /**
      * 批量删除看课投诉类型
-     * 
+     *
      * @param complaintTypeIds 需要删除的看课投诉类型主键集合
      * @return 结果
      */
@@ -53,9 +54,16 @@ public interface IFsUserCourseComplaintTypeService extends IService<FsUserCourse
 
     /**
      * 删除看课投诉类型信息
-     * 
+     *
      * @param complaintTypeId 看课投诉类型主键
      * @return 结果
      */
     int deleteFsUserCourseComplaintTypeByComplaintTypeId(Long complaintTypeId);
+
+    /**
+     * 获取投诉类型树结构
+     * @return list
+     */
+    List<FsUserCourseComplaintTypeListVO> getAllComplaintTypeTree();
+
 }

+ 20 - 10
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseComplaintRecordServiceImpl.java

@@ -3,7 +3,9 @@ package com.fs.course.service.impl;
 import java.util.List;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.fs.course.param.UserCourseComplaintRecordParam;
+import com.fs.course.vo.FsUserCourseComplaintRecordPageListVO;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import com.fs.course.mapper.FsUserCourseComplaintRecordMapper;
 import com.fs.course.domain.FsUserCourseComplaintRecord;
@@ -11,7 +13,7 @@ import com.fs.course.service.IFsUserCourseComplaintRecordService;
 
 /**
  * 看课投诉记录Service业务层处理
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
@@ -20,7 +22,7 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
 
     /**
      * 查询看课投诉记录
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 看课投诉记录
      */
@@ -32,19 +34,19 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
 
     /**
      * 查询看课投诉记录列表
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 看课投诉记录
      */
     @Override
-    public List<FsUserCourseComplaintRecord> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
+    public List<FsUserCourseComplaintRecordPageListVO> selectFsUserCourseComplaintRecordList(FsUserCourseComplaintRecord fsUserCourseComplaintRecord)
     {
-        return baseMapper.selectFsUserCourseComplaintRecordList(fsUserCourseComplaintRecord);
+        return baseMapper.selectFsUserCourseComplaintRecordPageList(fsUserCourseComplaintRecord);
     }
 
     /**
      * 新增看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -57,7 +59,7 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
 
     /**
      * 修改看课投诉记录
-     * 
+     *
      * @param fsUserCourseComplaintRecord 看课投诉记录
      * @return 结果
      */
@@ -69,7 +71,7 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
 
     /**
      * 批量删除看课投诉记录
-     * 
+     *
      * @param recordIds 需要删除的看课投诉记录主键
      * @return 结果
      */
@@ -81,7 +83,7 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
 
     /**
      * 删除看课投诉记录信息
-     * 
+     *
      * @param recordId 看课投诉记录主键
      * @return 结果
      */
@@ -90,4 +92,12 @@ public class FsUserCourseComplaintRecordServiceImpl extends ServiceImpl<FsUserCo
     {
         return baseMapper.deleteFsUserCourseComplaintRecordByRecordId(recordId);
     }
+
+    @Override
+    public int submitRecord(UserCourseComplaintRecordParam userCourseComplaintRecordParam) {
+        FsUserCourseComplaintRecord fsUserCourseComplaintRecord = new FsUserCourseComplaintRecord();
+        BeanUtils.copyProperties(userCourseComplaintRecordParam, fsUserCourseComplaintRecord);
+        fsUserCourseComplaintRecord.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertFsUserCourseComplaintRecord(fsUserCourseComplaintRecord);
+    }
 }

+ 49 - 9
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseComplaintTypeServiceImpl.java

@@ -1,9 +1,12 @@
 package com.fs.course.service.impl;
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
+
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.fs.course.vo.FsUserCourseComplaintTypeListVO;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import com.fs.course.mapper.FsUserCourseComplaintTypeMapper;
 import com.fs.course.domain.FsUserCourseComplaintType;
@@ -11,7 +14,7 @@ import com.fs.course.service.IFsUserCourseComplaintTypeService;
 
 /**
  * 看课投诉类型Service业务层处理
- * 
+ *
  * @author fs
  * @date 2025-06-04
  */
@@ -20,7 +23,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 查询看课投诉类型
-     * 
+     *
      * @param complaintTypeId 看课投诉类型主键
      * @return 看课投诉类型
      */
@@ -32,7 +35,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 查询看课投诉类型列表
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 看课投诉类型
      */
@@ -44,7 +47,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 新增看课投诉类型
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 结果
      */
@@ -57,7 +60,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 修改看课投诉类型
-     * 
+     *
      * @param fsUserCourseComplaintType 看课投诉类型
      * @return 结果
      */
@@ -70,7 +73,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 批量删除看课投诉类型
-     * 
+     *
      * @param complaintTypeIds 需要删除的看课投诉类型主键
      * @return 结果
      */
@@ -82,7 +85,7 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
 
     /**
      * 删除看课投诉类型信息
-     * 
+     *
      * @param complaintTypeId 看课投诉类型主键
      * @return 结果
      */
@@ -91,4 +94,41 @@ public class FsUserCourseComplaintTypeServiceImpl extends ServiceImpl<FsUserCour
     {
         return baseMapper.deleteFsUserCourseComplaintTypeByComplaintTypeId(complaintTypeId);
     }
+
+    @Override
+    public List<FsUserCourseComplaintTypeListVO> getAllComplaintTypeTree() {
+        FsUserCourseComplaintType fsUserCourseComplaintType = new FsUserCourseComplaintType();
+        List<FsUserCourseComplaintType> list = baseMapper.selectFsUserCourseComplaintTypeList(fsUserCourseComplaintType);
+        List<FsUserCourseComplaintTypeListVO> collect = list.stream().map(v -> {
+            FsUserCourseComplaintTypeListVO listVO = new FsUserCourseComplaintTypeListVO();
+            BeanUtils.copyProperties(v, listVO);
+            return listVO;
+        }).collect(Collectors.toList());
+
+        //构造树列表
+        return this.buildTree(collect);
+    }
+
+    private List<FsUserCourseComplaintTypeListVO> buildTree(List<FsUserCourseComplaintTypeListVO> complaintTypeList) {
+        List<FsUserCourseComplaintTypeListVO> complaintTypeVOList = new ArrayList<>();
+        Map<Long, FsUserCourseComplaintTypeListVO> complaintTypeMap = new HashMap<>();
+
+        for (FsUserCourseComplaintTypeListVO complaintTypeVO : complaintTypeList) {
+            complaintTypeVO.setChildrenType(new ArrayList<>());
+            complaintTypeMap.put(complaintTypeVO.getComplaintTypeId(), complaintTypeVO);
+        }
+
+        // 构造树列表
+        for (FsUserCourseComplaintTypeListVO complaintTypeVO : complaintTypeList) {
+            if(complaintTypeVO.getParentId() == null || complaintTypeVO.getParentId() == 0){
+                complaintTypeVOList.add(complaintTypeVO);
+            } else {
+                FsUserCourseComplaintTypeListVO complaintTypeListVOChildren = complaintTypeMap.get(complaintTypeVO.getParentId());
+                if(complaintTypeListVOChildren != null){
+                    complaintTypeListVOChildren.getChildrenType().add(complaintTypeVO);
+                }
+            }
+        }
+        return complaintTypeVOList;
+    }
 }

+ 46 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserCourseComplaintRecordPageListVO.java

@@ -0,0 +1,46 @@
+package com.fs.course.vo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsUserCourseComplaintRecordPageListVO extends BaseEntity{
+
+    /** 投诉记录id */
+    private Long recordId;
+
+    /** 用户id */
+    private Long userId;
+
+    @Excel(name = "用户昵称")
+    private String nickName;
+
+    @Excel(name = "投诉类型")
+    private String complaintTypeName;
+
+//    @Excel(name = "投诉内容")
+    private String complaintContent;
+
+    @Excel(name = "课程名称")
+    private String courseName;
+
+    @Excel(name = "小节名称")
+    private String title;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @Excel(name = "看课状态")
+    private String status;
+
+}

+ 27 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserCourseComplaintTypeListVO.java

@@ -0,0 +1,27 @@
+package com.fs.course.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.List;
+
+@ApiModel(value = "类型列表返回类")
+@Data
+public class FsUserCourseComplaintTypeListVO {
+
+    @ApiModelProperty(value = "投诉类型id")
+    private Long complaintTypeId;
+
+    @ApiModelProperty(value = "投诉类型名称")
+    private String complaintTypeName;
+
+    @ApiModelProperty(value = "级别,目前只有两级")
+    private Integer typeLevel;
+
+    @ApiModelProperty(value = "父级id")
+    private Long parentId;
+
+    @ApiModelProperty(value = "子类型")
+    private List<FsUserCourseComplaintTypeListVO> childrenType;
+
+}

+ 34 - 0
fs-service/src/main/resources/db/20250605-初始化表结构.sql

@@ -0,0 +1,34 @@
+-- ----------------------------
+-- Table structure for fs_user_course_complaint_record
+-- ----------------------------
+DROP TABLE IF EXISTS `fs_user_course_complaint_record`;
+CREATE TABLE `fs_user_course_complaint_record`  (
+                                                    `record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '投诉记录id',
+                                                    `user_id` bigint NULL DEFAULT NULL COMMENT '用户id,关联fs_user',
+                                                    `complaint_type_id` bigint NULL DEFAULT NULL COMMENT '投诉类型id',
+                                                    `complaint_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '投诉内容',
+                                                    `course_id` bigint NULL DEFAULT NULL COMMENT '课程id',
+                                                    `video_id` bigint NULL DEFAULT NULL COMMENT '视频小节id',
+                                                    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                                    PRIMARY KEY (`record_id`) USING BTREE,
+                                                    INDEX `user_id_index`(`user_id` ASC) USING BTREE,
+                                                    INDEX `complaint_type_id_index`(`complaint_type_id` ASC) USING BTREE,
+                                                    INDEX `course_id_index`(`course_id` ASC) USING BTREE,
+                                                    INDEX `video_id_index`(`video_id` ASC) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '看课投诉记录' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for fs_user_course_complaint_type
+-- ----------------------------
+DROP TABLE IF EXISTS `fs_user_course_complaint_type`;
+CREATE TABLE `fs_user_course_complaint_type`  (
+                                                  `complaint_type_id` bigint NOT NULL AUTO_INCREMENT COMMENT '投诉类型id',
+                                                  `parent_id` bigint NULL DEFAULT NULL COMMENT '父id,关联主键id',
+                                                  `complaint_type_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '投诉类型名称',
+                                                  `type_level` int NULL DEFAULT NULL COMMENT '级别(目前只有两级)',
+                                                  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                                  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
+                                                  PRIMARY KEY (`complaint_type_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '看课投诉类型表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 28 - 6
fs-service/src/main/resources/mapper/course/FsUserCourseComplaintRecordMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.course.mapper.FsUserCourseComplaintRecordMapper">
-    
+
     <resultMap type="FsUserCourseComplaintRecord" id="FsUserCourseComplaintRecordResult">
         <result property="recordId"    column="record_id"    />
         <result property="userId"    column="user_id"    />
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFsUserCourseComplaintRecordList" parameterType="FsUserCourseComplaintRecord" resultMap="FsUserCourseComplaintRecordResult">
         <include refid="selectFsUserCourseComplaintRecordVo"/>
-        <where>  
+        <where>
             <if test="userId != null "> and user_id = #{userId}</if>
             <if test="complaintTypeId != null "> and complaint_type_id = #{complaintTypeId}</if>
             <if test="complaintContent != null  and complaintContent != ''"> and complaint_content = #{complaintContent}</if>
@@ -28,12 +28,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="videoId != null "> and video_id = #{videoId}</if>
         </where>
     </select>
-    
+
+    <select id="selectFsUserCourseComplaintRecordPageList" resultType="com.fs.course.vo.FsUserCourseComplaintRecordPageListVO">
+        SELECT
+        cr.*,
+        ct.complaint_type_name,
+        uc.course_name,
+        ucv.title,
+        fs_user.nick_name,
+        if(ec.comment_status = 1,'已拉黑','正常') as status
+        FROM
+        fs_user_course_complaint_record cr
+        LEFT JOIN fs_user_course_complaint_type ct ON ct.complaint_type_id = cr.complaint_type_id
+        LEFT JOIN fs_user_course uc ON uc.course_id = cr.course_id
+        LEFT JOIN fs_user_course_video ucv ON ucv.video_id = cr.video_id
+        LEFT JOIN fs_user ON fs_user.user_id = cr.user_id
+        left join qw_external_contact ec on cr.user_id = ec.fs_user_id
+        <where>
+            <if test="nickName != null and nickName != '' ">
+                and fs_user.nick_name like concat('%', #{nickName}, '%')
+            </if>
+        </where>
+    </select>
+
     <select id="selectFsUserCourseComplaintRecordByRecordId" parameterType="Long" resultMap="FsUserCourseComplaintRecordResult">
         <include refid="selectFsUserCourseComplaintRecordVo"/>
         where record_id = #{recordId}
     </select>
-        
+
     <insert id="insertFsUserCourseComplaintRecord" parameterType="FsUserCourseComplaintRecord" useGeneratedKeys="true" keyProperty="recordId">
         insert into fs_user_course_complaint_record
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -72,9 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFsUserCourseComplaintRecordByRecordIds" parameterType="String">
-        delete from fs_user_course_complaint_record where record_id in 
+        delete from fs_user_course_complaint_record where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 7 - 12
fs-service/src/main/resources/mapper/course/FsUserCourseComplaintTypeMapper.xml

@@ -3,43 +3,40 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.course.mapper.FsUserCourseComplaintTypeMapper">
-    
+
     <resultMap type="FsUserCourseComplaintType" id="FsUserCourseComplaintTypeResult">
         <result property="complaintTypeId"    column="complaint_type_id"    />
         <result property="parentId"    column="parent_id"    />
         <result property="complaintTypeName"    column="complaint_type_name"    />
         <result property="typeLevel"    column="type_level"    />
-        <result property="isDel"    column="is_del"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
     </resultMap>
 
     <sql id="selectFsUserCourseComplaintTypeVo">
-        select complaint_type_id, parent_id, complaint_type_name, type_level, is_del, create_time, update_time from fs_user_course_complaint_type
+        select complaint_type_id, parent_id, complaint_type_name, type_level, create_time, update_time from fs_user_course_complaint_type
     </sql>
 
     <select id="selectFsUserCourseComplaintTypeList" parameterType="FsUserCourseComplaintType" resultMap="FsUserCourseComplaintTypeResult">
         <include refid="selectFsUserCourseComplaintTypeVo"/>
-        <where>  
+        <where>
             <if test="parentId != null "> and parent_id = #{parentId}</if>
             <if test="complaintTypeName != null  and complaintTypeName != ''"> and complaint_type_name like concat('%', #{complaintTypeName}, '%')</if>
             <if test="typeLevel != null "> and type_level = #{typeLevel}</if>
-            <if test="isDel != null "> and is_del = #{isDel}</if>
         </where>
     </select>
-    
+
     <select id="selectFsUserCourseComplaintTypeByComplaintTypeId" parameterType="Long" resultMap="FsUserCourseComplaintTypeResult">
         <include refid="selectFsUserCourseComplaintTypeVo"/>
         where complaint_type_id = #{complaintTypeId}
     </select>
-        
+
     <insert id="insertFsUserCourseComplaintType" parameterType="FsUserCourseComplaintType" useGeneratedKeys="true" keyProperty="complaintTypeId">
         insert into fs_user_course_complaint_type
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="parentId != null">parent_id,</if>
             <if test="complaintTypeName != null">complaint_type_name,</if>
             <if test="typeLevel != null">type_level,</if>
-            <if test="isDel != null">is_del,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
          </trim>
@@ -47,7 +44,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="parentId != null">#{parentId},</if>
             <if test="complaintTypeName != null">#{complaintTypeName},</if>
             <if test="typeLevel != null">#{typeLevel},</if>
-            <if test="isDel != null">#{isDel},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
          </trim>
@@ -59,7 +55,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="parentId != null">parent_id = #{parentId},</if>
             <if test="complaintTypeName != null">complaint_type_name = #{complaintTypeName},</if>
             <if test="typeLevel != null">type_level = #{typeLevel},</if>
-            <if test="isDel != null">is_del = #{isDel},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
@@ -71,9 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFsUserCourseComplaintTypeByComplaintTypeIds" parameterType="String">
-        delete from fs_user_course_complaint_type where complaint_type_id in 
+        delete from fs_user_course_complaint_type where complaint_type_id in
         <foreach item="complaintTypeId" collection="array" open="(" separator="," close=")">
             #{complaintTypeId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 48 - 0
fs-user-app/src/main/java/com/fs/app/controller/UserCourseComplaintController.java

@@ -0,0 +1,48 @@
+package com.fs.app.controller;
+
+import com.fs.app.annotation.Login;
+import com.fs.common.core.domain.R;
+import com.fs.course.param.UserCourseComplaintRecordParam;
+import com.fs.course.service.IFsUserCourseComplaintRecordService;
+import com.fs.course.service.IFsUserCourseComplaintTypeService;
+import com.fs.course.vo.FsUserCourseComplaintTypeListVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("看课投诉相关接口")
+@RestController
+@RequestMapping("/app/user/complaint")
+public class UserCourseComplaintController extends AppBaseController {
+
+    @Autowired
+    private IFsUserCourseComplaintTypeService fsUserCourseComplaintTypeService;
+
+    @Autowired
+    private IFsUserCourseComplaintRecordService fsUserCourseComplaintRecordService;
+
+    @Login
+    @ApiOperation("获取投诉类型")
+    @GetMapping("/getTypeTree")
+    public R getTypeTree() {
+        List<FsUserCourseComplaintTypeListVO> allComplaintTypeTree = fsUserCourseComplaintTypeService.getAllComplaintTypeTree();
+        return R.ok().put("data", allComplaintTypeTree);
+    }
+
+    @Login
+    @ApiOperation("提交反馈记录")
+    @PostMapping("/record")
+    public R submitRecord(@RequestBody UserCourseComplaintRecordParam param) {
+        param.setUserId(Long.parseLong(getUserId()));
+        int i = fsUserCourseComplaintRecordService.submitRecord(param);
+        if (i > 0) {
+            return R.ok();
+        } else {
+            return R.error();
+        }
+    }
+
+}