feat: 意见反馈,新增功能。

This commit is contained in:
tianyongbao
2026-07-13 09:07:47 +08:00
parent ddaaec2401
commit c85dfc2f05
8 changed files with 707 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
package com.intc.system.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.intc.common.core.utils.poi.ExcelUtil;
import com.intc.common.core.web.controller.BaseController;
import com.intc.common.core.web.domain.AjaxResult;
import com.intc.common.core.web.page.TableDataInfo;
import com.intc.common.log.annotation.Log;
import com.intc.common.log.enums.BusinessType;
import com.intc.common.security.annotation.RequiresPermissions;
import com.intc.common.security.utils.SecurityUtils;
import com.intc.system.domain.SysFeedback;
import com.intc.system.domain.dto.SysFeedbackDto;
import com.intc.system.domain.vo.SysFeedbackVo;
import com.intc.system.service.ISysFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 意见反馈Controller
*
* @author intc
* @date 2026-07-12
*/
@Api(tags = "意见反馈")
@RestController
@RequestMapping("/feedback")
public class SysFeedbackController extends BaseController
{
@Resource
private ISysFeedbackService sysFeedbackService;
/**
* 查询意见反馈列表(后台管理)
*/
@ApiOperation(value = "查询意见反馈列表")
@RequiresPermissions("system:feedback:list")
@GetMapping("/list")
public TableDataInfo list(SysFeedbackDto sysFeedbackDto)
{
startPage();
List<SysFeedbackVo> list = sysFeedbackService.selectSysFeedbackList(sysFeedbackDto);
return getDataTable(list);
}
/**
* 导出意见反馈列表
*/
@ApiOperation(value = "导出意见反馈列表")
@RequiresPermissions("system:feedback:export")
@Log(title = "意见反馈", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysFeedbackDto sysFeedbackDto)
{
List<SysFeedbackVo> list = sysFeedbackService.selectSysFeedbackList(sysFeedbackDto);
ExcelUtil<SysFeedbackVo> util = new ExcelUtil<SysFeedbackVo>(SysFeedbackVo.class);
util.exportExcel(response, list, "意见反馈数据");
}
/**
* 获取意见反馈详细信息
*/
@ApiOperation(value = "获取意见反馈详细信息")
@RequiresPermissions("system:feedback:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sysFeedbackService.selectSysFeedbackById(id));
}
/**
* 新增意见反馈(后台管理)
*/
@ApiOperation(value = "新增意见反馈")
@RequiresPermissions("system:feedback:add")
@Log(title = "意见反馈", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysFeedback sysFeedback)
{
sysFeedback.setCreateBy(SecurityUtils.getUsername());
return toAjax(sysFeedbackService.insertSysFeedback(sysFeedback));
}
/**
* 提交意见反馈H5/小程序端,需登录)
* <p>
* 前端通过文件上传接口(/file/upload先上传截图获取URL
* 再将多个截图URL以逗号分隔传入 images 字段。
*/
@ApiOperation(value = "提交意见反馈H5/小程序端)")
@Log(title = "意见反馈", businessType = BusinessType.INSERT)
@PostMapping("/submit")
public AjaxResult submit(@Validated @RequestBody SysFeedback sysFeedback)
{
sysFeedback.setCreateBy(SecurityUtils.getUsername());
return toAjax(sysFeedbackService.insertSysFeedback(sysFeedback));
}
/**
* 修改意见反馈
*/
@ApiOperation(value = "修改意见反馈")
@RequiresPermissions("system:feedback:edit")
@Log(title = "意见反馈", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysFeedback sysFeedback)
{
return toAjax(sysFeedbackService.updateSysFeedback(sysFeedback));
}
/**
* 回复意见反馈
*/
@ApiOperation(value = "回复意见反馈")
@RequiresPermissions("system:feedback:reply")
@Log(title = "意见反馈", businessType = BusinessType.UPDATE)
@PutMapping("/reply")
public AjaxResult reply(@RequestBody SysFeedback sysFeedback)
{
return toAjax(sysFeedbackService.replySysFeedback(sysFeedback));
}
/**
* 删除意见反馈
*/
@ApiOperation(value = "删除意见反馈")
@RequiresPermissions("system:feedback:remove")
@Log(title = "意见反馈", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysFeedbackService.deleteSysFeedbackByIds(ids));
}
}

View File

@@ -0,0 +1,97 @@
package com.intc.system.domain;
import com.intc.common.core.annotation.Excel;
import com.intc.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* 意见反馈对象 sys_feedback
*
* @author intc
* @date 2026-07-12
*/
@ApiModel("意见反馈对象")
@Data
public class SysFeedback extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 反馈类型(功能建议/问题反馈/数据异常/其他) */
@ApiModelProperty(value = "反馈类型")
@Excel(name = "反馈类型")
private String feedbackType;
/** 反馈内容 */
@ApiModelProperty(value = "反馈内容")
@NotBlank(message = "反馈内容不能为空")
@Size(min = 0, max = 500, message = "反馈内容不能超过500个字符")
@Excel(name = "反馈内容")
private String content;
/** 联系方式 */
@ApiModelProperty(value = "联系方式")
@Excel(name = "联系方式")
private String contact;
/** 截图URL列表多个用逗号分隔 */
@ApiModelProperty(value = "截图URL列表多个用逗号分隔")
private String images;
/** 反馈来源(小程序/H5/App等 */
@ApiModelProperty(value = "反馈来源")
@Excel(name = "反馈来源")
private String source;
/** 状态0待处理 1已处理 2已回复 */
@ApiModelProperty(value = "状态")
@Excel(name = "状态")
private String status;
/** 回复内容 */
@ApiModelProperty(value = "回复内容")
private String replyContent;
/** 回复人 */
@ApiModelProperty(value = "回复人")
private String replyBy;
/** 回复时间 */
@ApiModelProperty(value = "回复时间")
private Date replyTime;
/** 删除标志0存在 1删除 */
private String delFlag;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("feedbackType", getFeedbackType())
.append("content", getContent())
.append("contact", getContact())
.append("images", getImages())
.append("source", getSource())
.append("status", getStatus())
.append("replyContent", getReplyContent())
.append("replyBy", getReplyBy())
.append("replyTime", getReplyTime())
.append("createBy", getCreateBy())
.append("createName", getCreateName())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,36 @@
package com.intc.system.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 意见反馈Dto对象 sys_feedback
*
* @author intc
* @date 2026-07-12
*/
@ApiModel("意见反馈Dto对象")
@Data
public class SysFeedbackDto implements Serializable
{
private static final long serialVersionUID = 1L;
/** 反馈类型 */
@ApiModelProperty(value = "反馈类型")
private String feedbackType;
/** 状态 */
@ApiModelProperty(value = "状态")
private String status;
/** 反馈来源 */
@ApiModelProperty(value = "反馈来源")
private String source;
/** 创建者(查询某用户的反馈) */
@ApiModelProperty(value = "创建者")
private String createBy;
}

View File

@@ -0,0 +1,24 @@
package com.intc.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.intc.system.domain.SysFeedback;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 意见反馈Vo对象 sys_feedback
*
* @author intc
* @date 2026-07-12
*/
@ApiModel("意见反馈Vo对象")
@Data
public class SysFeedbackVo extends SysFeedback
{
/** 截图URL数组由 images 逗号分隔字符串拆分得到) */
@ApiModelProperty(value = "截图URL数组")
private String[] imageList;
}

View File

@@ -0,0 +1,63 @@
package com.intc.system.mapper;
import java.util.List;
import com.intc.system.domain.SysFeedback;
import com.intc.system.domain.dto.SysFeedbackDto;
import com.intc.system.domain.vo.SysFeedbackVo;
/**
* 意见反馈 数据层
*
* @author intc
* @date 2026-07-12
*/
public interface SysFeedbackMapper
{
/**
* 查询意见反馈信息
*
* @param id 意见反馈ID
* @return 意见反馈信息
*/
public SysFeedbackVo selectSysFeedbackById(Long id);
/**
* 查询意见反馈列表
*
* @param sysFeedbackDto 意见反馈查询对象
* @return 意见反馈集合
*/
public List<SysFeedbackVo> selectSysFeedbackList(SysFeedbackDto sysFeedbackDto);
/**
* 新增意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
public int insertSysFeedback(SysFeedback sysFeedback);
/**
* 修改意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
public int updateSysFeedback(SysFeedback sysFeedback);
/**
* 删除意见反馈(逻辑删除)
*
* @param id 意见反馈ID
* @return 结果
*/
public int deleteSysFeedbackById(Long id);
/**
* 批量删除意见反馈(逻辑删除)
*
* @param ids 需要删除的意见反馈ID
* @return 结果
*/
public int deleteSysFeedbackByIds(Long[] ids);
}

View File

@@ -0,0 +1,71 @@
package com.intc.system.service;
import java.util.List;
import com.intc.system.domain.SysFeedback;
import com.intc.system.domain.dto.SysFeedbackDto;
import com.intc.system.domain.vo.SysFeedbackVo;
/**
* 意见反馈 服务层
*
* @author intc
* @date 2026-07-12
*/
public interface ISysFeedbackService
{
/**
* 查询意见反馈信息
*
* @param id 意见反馈ID
* @return 意见反馈信息
*/
public SysFeedbackVo selectSysFeedbackById(Long id);
/**
* 查询意见反馈列表
*
* @param sysFeedbackDto 意见反馈查询对象
* @return 意见反馈集合
*/
public List<SysFeedbackVo> selectSysFeedbackList(SysFeedbackDto sysFeedbackDto);
/**
* 新增意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
public int insertSysFeedback(SysFeedback sysFeedback);
/**
* 修改意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
public int updateSysFeedback(SysFeedback sysFeedback);
/**
* 回复意见反馈
*
* @param sysFeedback 意见反馈信息(含回复内容)
* @return 结果
*/
public int replySysFeedback(SysFeedback sysFeedback);
/**
* 删除意见反馈
*
* @param id 意见反馈ID
* @return 结果
*/
public int deleteSysFeedbackById(Long id);
/**
* 批量删除意见反馈
*
* @param ids 需要删除的意见反馈ID
* @return 结果
*/
public int deleteSysFeedbackByIds(Long[] ids);
}

View File

@@ -0,0 +1,148 @@
package com.intc.system.service.impl;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.intc.common.core.utils.DateUtils;
import com.intc.common.core.utils.IdWorker;
import com.intc.common.security.utils.SecurityUtils;
import com.intc.system.domain.SysFeedback;
import com.intc.system.domain.dto.SysFeedbackDto;
import com.intc.system.domain.vo.SysFeedbackVo;
import com.intc.system.mapper.SysFeedbackMapper;
import com.intc.system.service.ISysFeedbackService;
/**
* 意见反馈 服务层实现
*
* @author intc
* @date 2026-07-12
*/
@Service
public class SysFeedbackServiceImpl implements ISysFeedbackService
{
@Resource
private SysFeedbackMapper sysFeedbackMapper;
/**
* 查询意见反馈信息
*
* @param id 意见反馈ID
* @return 意见反馈信息
*/
@Override
public SysFeedbackVo selectSysFeedbackById(Long id)
{
SysFeedbackVo vo = sysFeedbackMapper.selectSysFeedbackById(id);
fillImageList(vo);
return vo;
}
/**
* 查询意见反馈列表
*
* @param sysFeedbackDto 意见反馈查询对象
* @return 意见反馈集合
*/
@Override
public List<SysFeedbackVo> selectSysFeedbackList(SysFeedbackDto sysFeedbackDto)
{
List<SysFeedbackVo> list = sysFeedbackMapper.selectSysFeedbackList(sysFeedbackDto);
for (SysFeedbackVo vo : list)
{
fillImageList(vo);
}
return list;
}
/**
* 新增意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
@Override
public int insertSysFeedback(SysFeedback sysFeedback)
{
sysFeedback.setId(IdWorker.getId());
sysFeedback.setCreateTime(DateUtils.getNowDate());
if (sysFeedback.getStatus() == null || sysFeedback.getStatus().isEmpty())
{
sysFeedback.setStatus("0");
}
if (sysFeedback.getDelFlag() == null || sysFeedback.getDelFlag().isEmpty())
{
sysFeedback.setDelFlag("0");
}
return sysFeedbackMapper.insertSysFeedback(sysFeedback);
}
/**
* 修改意见反馈
*
* @param sysFeedback 意见反馈信息
* @return 结果
*/
@Override
public int updateSysFeedback(SysFeedback sysFeedback)
{
sysFeedback.setUpdateBy(SecurityUtils.getUsername());
sysFeedback.setUpdateTime(DateUtils.getNowDate());
return sysFeedbackMapper.updateSysFeedback(sysFeedback);
}
/**
* 回复意见反馈
*
* @param sysFeedback 意见反馈信息(含回复内容)
* @return 结果
*/
@Override
public int replySysFeedback(SysFeedback sysFeedback)
{
sysFeedback.setStatus("2");
sysFeedback.setReplyBy(SecurityUtils.getUsername());
sysFeedback.setReplyTime(DateUtils.getNowDate());
sysFeedback.setUpdateBy(SecurityUtils.getUsername());
sysFeedback.setUpdateTime(DateUtils.getNowDate());
return sysFeedbackMapper.updateSysFeedback(sysFeedback);
}
/**
* 删除意见反馈
*
* @param id 意见反馈ID
* @return 结果
*/
@Override
public int deleteSysFeedbackById(Long id)
{
return sysFeedbackMapper.deleteSysFeedbackById(id);
}
/**
* 批量删除意见反馈
*
* @param ids 需要删除的意见反馈ID
* @return 结果
*/
@Override
public int deleteSysFeedbackByIds(Long[] ids)
{
return sysFeedbackMapper.deleteSysFeedbackByIds(ids);
}
/**
* 填充截图URL数组
*
* @param vo 意见反馈Vo
*/
private void fillImageList(SysFeedbackVo vo)
{
if (vo != null && vo.getImages() != null && !vo.getImages().isEmpty())
{
vo.setImageList(vo.getImages().split(","));
}
}
}

View File

@@ -0,0 +1,129 @@
<?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.intc.system.mapper.SysFeedbackMapper">
<resultMap type="SysFeedbackVo" id="SysFeedbackResult">
<result property="id" column="id" />
<result property="feedbackType" column="feedback_type" />
<result property="content" column="content" />
<result property="contact" column="contact" />
<result property="images" column="images" />
<result property="source" column="source" />
<result property="status" column="status" />
<result property="replyContent" column="reply_content" />
<result property="replyBy" column="reply_by" />
<result property="replyTime" column="reply_time" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createName" column="create_name" />
<result property="createDeptId" column="create_dept_id" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysFeedbackVo">
select id, feedback_type, content, contact, images, source, status, reply_content, reply_by, reply_time,
del_flag, create_by, create_name, create_dept_id, create_time, update_by, update_time, remark
from sys_feedback
where del_flag = '0'
</sql>
<select id="selectSysFeedbackById" parameterType="Long" resultMap="SysFeedbackResult">
<include refid="selectSysFeedbackVo"/>
and id = #{id}
</select>
<select id="selectSysFeedbackList" parameterType="SysFeedbackDto" resultMap="SysFeedbackResult">
<include refid="selectSysFeedbackVo"/>
<if test="feedbackType != null and feedbackType != ''">
AND feedback_type = #{feedbackType}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="source != null and source != ''">
AND source = #{source}
</if>
<if test="createBy != null and createBy != ''">
AND create_by = #{createBy}
</if>
order by create_time desc
</select>
<insert id="insertSysFeedback" parameterType="SysFeedback">
insert into sys_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="feedbackType != null">feedback_type,</if>
<if test="content != null and content != ''">content,</if>
<if test="contact != null">contact,</if>
<if test="images != null">images,</if>
<if test="source != null">source,</if>
<if test="status != null and status != ''">status,</if>
<if test="replyContent != null">reply_content,</if>
<if test="replyBy != null">reply_by,</if>
<if test="replyTime != null">reply_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createName != null">create_name,</if>
<if test="createDeptId != null">create_dept_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},
<if test="feedbackType != null">#{feedbackType},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="contact != null">#{contact},</if>
<if test="images != null">#{images},</if>
<if test="source != null">#{source},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="replyContent != null">#{replyContent},</if>
<if test="replyBy != null">#{replyBy},</if>
<if test="replyTime != null">#{replyTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createName != null">#{createName},</if>
<if test="createDeptId != null">#{createDeptId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysFeedback" parameterType="SysFeedback">
update sys_feedback
<trim prefix="SET" suffixOverrides=",">
<if test="feedbackType != null">feedback_type = #{feedbackType},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="contact != null">contact = #{contact},</if>
<if test="images != null">images = #{images},</if>
<if test="source != null">source = #{source},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="replyContent != null">reply_content = #{replyContent},</if>
<if test="replyBy != null">reply_by = #{replyBy},</if>
<if test="replyTime != null">reply_time = #{replyTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysFeedbackById" parameterType="Long">
update sys_feedback set del_flag = '1' where id = #{id}
</update>
<update id="deleteSysFeedbackByIds" parameterType="Long">
update sys_feedback set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>