feat:用户反馈
This commit is contained in:
1 parent
ccf944bd85
commit
58dfd2d76a
11 files changed
+458
No files matched your search
@@ -212,6 +212,24 @@ CREATE TABLE `member_open_type_user`
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '会员开通类型与用户关联表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for member_feedback
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `member_feedback`;
|
||||
CREATE TABLE `member_feedback`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户反馈id',
|
||||
`member_id` bigint NOT NULL COMMENT '用户编号',
|
||||
`content` varchar(256) DEFAULT NULL COMMENT '反馈内容',
|
||||
`pic` varchar(1024) DEFAULT NULL COMMENT '反馈图片',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户反馈表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for product_gift
|
||||
|
||||
+3
@@ -75,4 +75,7 @@ public interface MemberErrorCode {
|
||||
|
||||
//========== 会员开通类型 1-004-016-000 ==========
|
||||
ErrorCode OPEN_TYPE_NOT_EXISTS = new ErrorCode(1_004_016_000, "开通类型不存在");
|
||||
|
||||
//========== 会员开通类型 1-004-017-000 ==========
|
||||
ErrorCode FEEDBACK_NOT_EXISTS = new ErrorCode(1_004_017_000, "反馈不存在");
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.feedback;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.module.member.service.feedback.FeedbackService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户反馈")
|
||||
@RestController
|
||||
@RequestMapping("/member/feedback")
|
||||
@Validated
|
||||
public class FeedbackController {
|
||||
|
||||
@Resource
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户反馈")
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:create')")
|
||||
public CommonResult<Long> createFeedback(@Valid @RequestBody FeedbackSaveReqVO createReqVO) {
|
||||
return success(feedbackService.createFeedback(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户反馈")
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:update')")
|
||||
public CommonResult<Boolean> updateFeedback(@Valid @RequestBody FeedbackSaveReqVO updateReqVO) {
|
||||
feedbackService.updateFeedback(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户反馈")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:delete')")
|
||||
public CommonResult<Boolean> deleteFeedback(@RequestParam("id") Long id) {
|
||||
feedbackService.deleteFeedback(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户反馈")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:query')")
|
||||
public CommonResult<FeedbackRespVO> getFeedback(@RequestParam("id") Long id) {
|
||||
FeedbackDO feedback = feedbackService.getFeedback(id);
|
||||
return success(BeanUtils.toBean(feedback, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户反馈分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:query')")
|
||||
public CommonResult<PageResult<FeedbackRespVO>> getFeedbackPage(@Valid FeedbackPageReqVO pageReqVO) {
|
||||
PageResult<FeedbackDO> pageResult = feedbackService.getFeedbackPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户反馈 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('member:feedback:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportFeedbackExcel(@Valid FeedbackPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FeedbackDO> list = feedbackService.getFeedbackPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用户反馈.xls", "数据", FeedbackRespVO.class, BeanUtils.toBean(list, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.feedback.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FeedbackPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "15139")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "反馈内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.feedback.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FeedbackRespVO {
|
||||
|
||||
@Schema(description = "用户反馈id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23265")
|
||||
@ExcelProperty("用户反馈id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15139")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "反馈内容")
|
||||
@ExcelProperty("反馈内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "反馈图片")
|
||||
@ExcelProperty("反馈图片")
|
||||
private String pic;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.feedback.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈新增/修改 Request VO")
|
||||
@Data
|
||||
public class FeedbackSaveReqVO {
|
||||
|
||||
@Schema(description = "用户反馈id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23265")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15139")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "反馈内容")
|
||||
@NotNull(message = "反馈内容不能为空")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "反馈图片")
|
||||
private String pic;
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.feedback;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.FeedbackPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.FeedbackRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.FeedbackSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.module.member.service.feedback.FeedbackService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "用户 App - 用户反馈")
|
||||
@RestController
|
||||
@RequestMapping("/member/feedback")
|
||||
@Validated
|
||||
public class AppFeedbackController {
|
||||
|
||||
@Resource
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户反馈")
|
||||
public CommonResult<Long> createFeedback(@Valid @RequestBody FeedbackSaveReqVO createReqVO) {
|
||||
createReqVO.setMemberId(getLoginUserId());
|
||||
return success(feedbackService.createFeedback(createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户反馈详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<FeedbackRespVO> getFeedback(@RequestParam("id") Long id) {
|
||||
FeedbackDO feedback = feedbackService.getFeedback(id);
|
||||
return success(BeanUtils.toBean(feedback, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户反馈分页")
|
||||
public CommonResult<PageResult<FeedbackRespVO>> getFeedbackPage(@Valid FeedbackPageReqVO pageReqVO) {
|
||||
pageReqVO.setMemberId(getLoginUserId());
|
||||
PageResult<FeedbackDO> pageResult = feedbackService.getFeedbackPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.feedback;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户反馈 DO
|
||||
*/
|
||||
@TableName("member_feedback")
|
||||
@KeySequence("member_feedback_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FeedbackDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 用户反馈id
|
||||
*/
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long memberId;
|
||||
|
||||
/**
|
||||
* 反馈内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 反馈图片
|
||||
*/
|
||||
private String pic;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.feedback;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.feedback.FeedbackDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.*;
|
||||
|
||||
/**
|
||||
* 用户反馈 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface FeedbackMapper extends BaseMapperX<FeedbackDO> {
|
||||
|
||||
default PageResult<FeedbackDO> selectPage(FeedbackPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FeedbackDO>()
|
||||
.eqIfPresent(FeedbackDO::getMemberId, reqVO.getMemberId())
|
||||
.likeIfPresent(FeedbackDO::getContent, reqVO.getContent())
|
||||
.betweenIfPresent(FeedbackDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FeedbackDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.member.service.feedback;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 用户反馈 Service 接口
|
||||
*/
|
||||
public interface FeedbackService {
|
||||
|
||||
/**
|
||||
* 创建用户反馈
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createFeedback(@Valid FeedbackSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户反馈
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFeedback(@Valid FeedbackSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户反馈
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFeedback(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户反馈
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户反馈
|
||||
*/
|
||||
FeedbackDO getFeedback(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户反馈分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户反馈分页
|
||||
*/
|
||||
PageResult<FeedbackDO> getFeedbackPage(FeedbackPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.member.service.feedback;
|
||||
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.feedback.FeedbackMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 用户反馈 Service 实现类
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FeedbackServiceImpl implements FeedbackService {
|
||||
|
||||
@Resource
|
||||
private FeedbackMapper feedbackMapper;
|
||||
|
||||
@Override
|
||||
public Long createFeedback(FeedbackSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FeedbackDO feedback = BeanUtils.toBean(createReqVO, FeedbackDO.class);
|
||||
feedbackMapper.insert(feedback);
|
||||
// 返回
|
||||
return feedback.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFeedback(FeedbackSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFeedbackExists(updateReqVO.getId());
|
||||
// 更新
|
||||
FeedbackDO updateObj = BeanUtils.toBean(updateReqVO, FeedbackDO.class);
|
||||
feedbackMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFeedback(Long id) {
|
||||
// 校验存在
|
||||
validateFeedbackExists(id);
|
||||
// 删除
|
||||
feedbackMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateFeedbackExists(Long id) {
|
||||
if (feedbackMapper.selectById(id) == null) {
|
||||
throw exception(MemberErrorCode.ADDRESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedbackDO getFeedback(Long id) {
|
||||
return feedbackMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FeedbackDO> getFeedbackPage(FeedbackPageReqVO pageReqVO) {
|
||||
return feedbackMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user