init
This commit is contained in:
@@ -0,0 +1,82 @@
|
|||||||
|
package com.ruoyi.xq.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.xq.domain.Feedback;
|
||||||
|
import com.ruoyi.xq.service.FeedbackService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言举报
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-18
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xq/feedback")
|
||||||
|
public class FeedbackController extends BaseController {
|
||||||
|
|
||||||
|
private final FeedbackService feedbackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询留言举报列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:feedback:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<Feedback> list(Feedback bo, PageQuery pageQuery) {
|
||||||
|
Page<Feedback> page = feedbackService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取留言举报详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:feedback:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<Feedback> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||||
|
return R.ok(feedbackService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改留言举报
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:feedback:edit")
|
||||||
|
@Log(title = "留言举报", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody Feedback bo) {
|
||||||
|
return toAjax(feedbackService.updateById(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除留言举报
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:feedback:remove")
|
||||||
|
@Log(title = "留言举报", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(feedbackService.removeBatchByIds(Arrays.asList(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.ruoyi.xq.controller.app;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.xq.dto.app.other.FeedbackReq;
|
||||||
|
import com.ruoyi.xq.dto.app.report.ReportPushReq;
|
||||||
|
import com.ruoyi.xq.service.FeedbackService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/other")
|
||||||
|
@Tag(name = "其他接口")
|
||||||
|
@Slf4j
|
||||||
|
public class OtherController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeedbackService feedbackService;
|
||||||
|
|
||||||
|
@PostMapping("/feedback")
|
||||||
|
@Operation(summary = "留言反馈")
|
||||||
|
@Log(title = "留言反馈", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<Void> feedback(@RequestBody FeedbackReq req){
|
||||||
|
feedbackService.feedback(req);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
55
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/Feedback.java
Normal file
55
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/Feedback.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package com.ruoyi.xq.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言举报对象 xq_feedback
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("xq_feedback")
|
||||||
|
public class Feedback implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户号
|
||||||
|
*/
|
||||||
|
private String usercode;
|
||||||
|
/**
|
||||||
|
* 留言标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 留言内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 留言手机
|
||||||
|
*/
|
||||||
|
private String feedbackMobile;
|
||||||
|
/**
|
||||||
|
* 状态 0 未处理 1 已经处理
|
||||||
|
*/
|
||||||
|
private Integer reportStatus;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.other;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FeedbackReq {
|
||||||
|
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "留言标题")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 留言内容
|
||||||
|
*/
|
||||||
|
@Schema(description = "留言内容")
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 留言手机
|
||||||
|
*/
|
||||||
|
@Schema(description = "留言手机")
|
||||||
|
private String feedbackMobile;
|
||||||
|
}
|
||||||
@@ -93,7 +93,7 @@ public class CurrentUserFullInfoVo {
|
|||||||
* 职业
|
* 职业
|
||||||
*/
|
*/
|
||||||
@Schema(description = "职业")
|
@Schema(description = "职业")
|
||||||
private Integer profession;
|
private String profession;
|
||||||
/**
|
/**
|
||||||
* 年收入
|
* 年收入
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.xq.enums.other;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum FeedbackReportStatusEnum {
|
||||||
|
|
||||||
|
NO_DEAL(0,"未处理"),
|
||||||
|
SUCCESS(1,"已处理"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
FeedbackReportStatusEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.xq.domain.Feedback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言举报Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-18
|
||||||
|
*/
|
||||||
|
public interface FeedbackMapper extends BaseMapper<Feedback> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.xq.domain.Feedback;
|
||||||
|
import com.ruoyi.xq.dto.app.other.FeedbackReq;
|
||||||
|
import com.ruoyi.xq.dto.app.report.ReportPushReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言举报Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-18
|
||||||
|
*/
|
||||||
|
public interface FeedbackService extends IService<Feedback> {
|
||||||
|
|
||||||
|
void feedback(FeedbackReq req);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.xq.domain.Feedback;
|
||||||
|
import com.ruoyi.xq.dto.app.other.FeedbackReq;
|
||||||
|
import com.ruoyi.xq.dto.common.user.MinUser;
|
||||||
|
import com.ruoyi.xq.enums.other.FeedbackReportStatusEnum;
|
||||||
|
import com.ruoyi.xq.mapper.FeedbackMapper;
|
||||||
|
import com.ruoyi.xq.service.FeedbackService;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言举报Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-04-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper,Feedback> implements FeedbackService {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void feedback(FeedbackReq req) {
|
||||||
|
MinUser minUser = userService.getMinUserById(req.getUserId());
|
||||||
|
Feedback feedback = new Feedback();
|
||||||
|
feedback.setUserId(minUser.getId());
|
||||||
|
feedback.setUsercode(minUser.getUsercode());
|
||||||
|
feedback.setTitle(req.getTitle());
|
||||||
|
feedback.setContent(req.getContent());
|
||||||
|
feedback.setFeedbackMobile(req.getFeedbackMobile());
|
||||||
|
feedback.setReportStatus(FeedbackReportStatusEnum.NO_DEAL.getCode());
|
||||||
|
this.save(feedback);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import com.ruoyi.common.utils.BeanConvertUtil;
|
|||||||
import com.ruoyi.xq.domain.*;
|
import com.ruoyi.xq.domain.*;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
||||||
|
import com.ruoyi.xq.dto.app.auth.LoginUser;
|
||||||
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
||||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||||
@@ -107,6 +108,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
result.setOpenVip(true);
|
result.setOpenVip(true);
|
||||||
result.setVipType(userVip.getVipType());
|
result.setVipType(userVip.getVipType());
|
||||||
}
|
}
|
||||||
|
Long currentUserId = LoginHelper.getUserId();
|
||||||
|
if(userId.equals(currentUserId)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
UserStatus userStatus = userStatusService.getByUserId(userId);
|
UserStatus userStatus = userStatusService.getByUserId(userId);
|
||||||
boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar());
|
boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar());
|
||||||
if(!showAvatar){
|
if(!showAvatar){
|
||||||
|
|||||||
20
ruoyi-xq/src/main/resources/mapper/xq/FeedbackMapper.xml
Normal file
20
ruoyi-xq/src/main/resources/mapper/xq/FeedbackMapper.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.xq.mapper.FeedbackMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.xq.domain.Feedback" id="FeedbackResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="usercode" column="usercode"/>
|
||||||
|
<result property="title" column="title"/>
|
||||||
|
<result property="content" column="content"/>
|
||||||
|
<result property="feedbackMobile" column="feedback_mobile"/>
|
||||||
|
<result property="reportStatus" column="report_status"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user