feat(electron-vue-template):重构认证与设备管理模块

- 统一token存取逻辑,封装getToken/setToken/removeToken方法
-优化设备ID获取逻辑,调整API路径
- 完善设备管理接口类型定义,增强类型安全
- 调整SSE连接逻辑,使用统一配置管理- 重构HTTP客户端,集中管理后端服务配置
- 更新认证相关API接口,完善请求/响应类型
- 优化设备列表展示逻辑,移除冗余字段
- 调整图片代理路径,统一API前缀
- 完善用户反馈列表展示功能,增强交互体验
- 移除冗余的错误处理逻辑,简化代码结构
This commit is contained in:
2025-10-16 10:37:00 +08:00
parent 6f04658265
commit 132299c4b7
37 changed files with 2193 additions and 682 deletions

View File

@@ -0,0 +1,115 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户端用户反馈对象 client_feedback
*
* @author ruoyi
*/
public class ClientFeedback extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 用户名 */
@Excel(name = "用户名")
private String username;
/** 设备ID */
@Excel(name = "设备ID")
private String deviceId;
/** 反馈内容 */
@Excel(name = "反馈内容")
private String feedbackContent;
/** 日志文件路径 */
@Excel(name = "日志文件路径")
private String logFilePath;
/** 日志日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日志日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date logDate;
/** 处理状态 */
@Excel(name = "处理状态")
private String status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setFeedbackContent(String feedbackContent)
{
this.feedbackContent = feedbackContent;
}
public String getFeedbackContent()
{
return feedbackContent;
}
public void setLogFilePath(String logFilePath)
{
this.logFilePath = logFilePath;
}
public String getLogFilePath()
{
return logFilePath;
}
public void setLogDate(Date logDate)
{
this.logDate = logDate;
}
public Date getLogDate()
{
return logDate;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
}

View File

@@ -0,0 +1,49 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.ClientFeedback;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ClientFeedbackMapper {
/**
* 查询反馈列表
*/
List<ClientFeedback> selectFeedbackList(ClientFeedback feedback);
/**
* 根据ID查询反馈
*/
ClientFeedback selectFeedbackById(Long id);
/**
* 新增反馈
*/
int insertFeedback(ClientFeedback feedback);
/**
* 更新反馈
*/
int updateFeedback(ClientFeedback feedback);
/**
* 删除反馈
*/
int deleteFeedbackById(Long id);
/**
* 统计待处理反馈数量
*/
int countPendingFeedback();
/**
* 统计今日反馈数量
*/
int countTodayFeedback();
/**
* 更新反馈状态
*/
int updateFeedbackStatus(@Param("id") Long id, @Param("status") String status);
}

View File

@@ -0,0 +1,106 @@
<?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.system.mapper.ClientFeedbackMapper">
<resultMap type="com.ruoyi.system.domain.ClientFeedback" id="ClientFeedbackResult">
<result property="id" column="id" />
<result property="username" column="username" />
<result property="deviceId" column="device_id" />
<result property="feedbackContent" column="feedback_content"/>
<result property="logFilePath" column="log_file_path" />
<result property="logDate" column="log_date" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectFeedbackVo">
select id, username, device_id, feedback_content, log_file_path, log_date,
status, create_time, update_time, remark
from client_feedback
</sql>
<select id="selectFeedbackList" parameterType="com.ruoyi.system.domain.ClientFeedback" resultMap="ClientFeedbackResult">
<include refid="selectFeedbackVo"/>
<where>
<if test="username != null and username != ''">
AND username like concat('%', #{username}, '%')
</if>
<if test="deviceId != null and deviceId != ''">
AND device_id = #{deviceId}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by create_time desc
</select>
<select id="selectFeedbackById" parameterType="Long" resultMap="ClientFeedbackResult">
<include refid="selectFeedbackVo"/>
where id = #{id}
</select>
<insert id="insertFeedback" parameterType="com.ruoyi.system.domain.ClientFeedback" useGeneratedKeys="true" keyProperty="id">
insert into client_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="username != null and username != ''">username,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="feedbackContent != null and feedbackContent != ''">feedback_content,</if>
<if test="logFilePath != null and logFilePath != ''">log_file_path,</if>
<if test="logDate != null">log_date,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null and username != ''">#{username},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="feedbackContent != null and feedbackContent != ''">#{feedbackContent},</if>
<if test="logFilePath != null and logFilePath != ''">#{logFilePath},</if>
<if test="logDate != null">#{logDate},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
</trim>
</insert>
<update id="updateFeedback" parameterType="com.ruoyi.system.domain.ClientFeedback">
update client_feedback
<trim prefix="SET" suffixOverrides=",">
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</trim>
where id = #{id}
</update>
<delete id="deleteFeedbackById" parameterType="Long">
delete from client_feedback where id = #{id}
</delete>
<select id="countPendingFeedback" resultType="int">
select count(*) from client_feedback where status = 'pending'
</select>
<select id="countTodayFeedback" resultType="int">
select count(*) from client_feedback
where date_format(create_time,'%Y-%m-%d') = date_format(sysdate(),'%Y-%m-%d')
</select>
<update id="updateFeedbackStatus">
update client_feedback set status = #{status}, update_time = sysdate()
where id = #{id}
</update>
</mapper>