feat: 增强用户端配置管理功能

主要修改:
1. 在SystemConfigController中完善用户端配置获取和批量更新接口的实现。
2. 优化SystemConfigService,增强配置值验证逻辑,确保配置的准确性和有效性。

技术细节:
- 新增的功能提升了用户端配置的管理灵活性,支持更高效的批量操作。
This commit is contained in:
zyh
2025-08-27 17:25:19 +08:00
parent 429e12cf50
commit b03c58ae1b
6 changed files with 677 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package com.gameplatform.server.model.dto.admin;
import com.gameplatform.server.model.entity.admin.Announcement;
public class AnnouncementConverter {
/**
* 将请求DTO转换为实体
*/
public static Announcement toEntity(AnnouncementRequest request) {
if (request == null) {
return null;
}
Announcement announcement = new Announcement();
announcement.setTitle(request.getTitle());
announcement.setContent(request.getContent());
announcement.setEnabled(request.getEnabled());
announcement.setJumpUrl(request.getJumpUrl());
return announcement;
}
/**
* 将实体转换为响应DTO
*/
public static AnnouncementResponse toResponse(Announcement announcement) {
if (announcement == null) {
return null;
}
AnnouncementResponse response = new AnnouncementResponse();
response.setId(announcement.getId());
response.setTitle(announcement.getTitle());
response.setContent(announcement.getContent());
response.setEnabled(announcement.getEnabled());
response.setJumpUrl(announcement.getJumpUrl());
response.setCreatedAt(announcement.getCreatedAt());
response.setUpdatedAt(announcement.getUpdatedAt());
return response;
}
}

View File

@@ -0,0 +1,51 @@
package com.gameplatform.server.model.dto.admin;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "公告请求DTO")
public class AnnouncementRequest {
@Schema(description = "公告标题", required = true, example = "系统维护通知")
private String title;
@Schema(description = "公告内容", required = true, example = "系统将于今晚10点进行维护预计维护时间2小时")
private String content;
@Schema(description = "是否启用", required = true, example = "true")
private Boolean enabled;
@Schema(description = "跳转链接", example = "https://example.com")
private String jumpUrl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getJumpUrl() {
return jumpUrl;
}
public void setJumpUrl(String jumpUrl) {
this.jumpUrl = jumpUrl;
}
}

View File

@@ -0,0 +1,85 @@
package com.gameplatform.server.model.dto.admin;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
@Schema(description = "公告响应DTO")
public class AnnouncementResponse {
@Schema(description = "公告ID", example = "1")
private Long id;
@Schema(description = "公告标题", example = "系统维护通知")
private String title;
@Schema(description = "公告内容", example = "系统将于今晚10点进行维护预计维护时间2小时")
private String content;
@Schema(description = "是否启用", example = "true")
private Boolean enabled;
@Schema(description = "跳转链接", example = "https://example.com")
private String jumpUrl;
@Schema(description = "创建时间")
private LocalDateTime createdAt;
@Schema(description = "更新时间")
private LocalDateTime updatedAt;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getJumpUrl() {
return jumpUrl;
}
public void setJumpUrl(String jumpUrl) {
this.jumpUrl = jumpUrl;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
}