mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-08 14:15:34 +08:00
feat(platform): 站点配置支持微信号与 contentHash
新增 companyWechat 字段及校验文案;GET 返回 contentHash(对入库 configData 做 MD5),供 Web/H5 本地缓存比对,避免无变更时重复 apply。
This commit is contained in:
@@ -430,6 +430,33 @@
|
||||
"urlType": {
|
||||
"notBlank": "URL type cannot be blank"
|
||||
},
|
||||
"systemName": {
|
||||
"size": "System name must not exceed {max} characters"
|
||||
},
|
||||
"companyName": {
|
||||
"size": "Company name must not exceed {max} characters"
|
||||
},
|
||||
"companyEmail": {
|
||||
"email": "Invalid email format"
|
||||
},
|
||||
"companyWechat": {
|
||||
"size": "WeChat ID must not exceed {max} characters"
|
||||
},
|
||||
"copyright": {
|
||||
"size": "Copyright text must not exceed {max} characters"
|
||||
},
|
||||
"icpLink": {
|
||||
"pattern": "URL must start with http:// or https://"
|
||||
},
|
||||
"mpsLink": {
|
||||
"pattern": "URL must start with http:// or https://"
|
||||
},
|
||||
"pcacLink": {
|
||||
"pattern": "URL must start with http:// or https://"
|
||||
},
|
||||
"icpPlusLink": {
|
||||
"pattern": "URL must start with http:// or https://"
|
||||
},
|
||||
"dictId": {
|
||||
"notNull": "Dictionary ID cannot be blank"
|
||||
},
|
||||
|
||||
@@ -433,6 +433,33 @@
|
||||
"urlType": {
|
||||
"notBlank": "端点类型不能为空"
|
||||
},
|
||||
"systemName": {
|
||||
"size": "系统名称长度不能超过{max}个字符"
|
||||
},
|
||||
"companyName": {
|
||||
"size": "公司全称长度不能超过{max}个字符"
|
||||
},
|
||||
"companyEmail": {
|
||||
"email": "邮箱格式不正确"
|
||||
},
|
||||
"companyWechat": {
|
||||
"size": "微信号长度不能超过{max}个字符"
|
||||
},
|
||||
"copyright": {
|
||||
"size": "版权信息长度不能超过{max}个字符"
|
||||
},
|
||||
"icpLink": {
|
||||
"pattern": "链接必须以 http:// 或 https:// 开头"
|
||||
},
|
||||
"mpsLink": {
|
||||
"pattern": "链接必须以 http:// 或 https:// 开头"
|
||||
},
|
||||
"pcacLink": {
|
||||
"pattern": "链接必须以 http:// 或 https:// 开头"
|
||||
},
|
||||
"icpPlusLink": {
|
||||
"pattern": "链接必须以 http:// 或 https:// 开头"
|
||||
},
|
||||
"dictId": {
|
||||
"notNull": "字典ID不可为空"
|
||||
},
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package cn.daxpay.open.platform.system.entity.config.platform.infra;
|
||||
|
||||
import cn.daxpay.open.platform.system.enums.PlatformConfigTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/// # 平台站点显示内容配置
|
||||
///
|
||||
/// 系统名称、公司信息、Logo、备案与版权等展示配置.
|
||||
/// 全局唯一, 通过 [PlatformConfigTypeEnum.WEBSITE] 以 JSON 存于 `system_platform_config`.
|
||||
/// 全局唯一, 通过 [PlatformConfigTypeEnum#WEBSITE] 以 JSON 存于 `system_platform_config`.
|
||||
///
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@@ -24,11 +25,14 @@ public class PlatformWebsiteConfig {
|
||||
/// 公司邮箱
|
||||
private String companyEmail;
|
||||
|
||||
/// 系统完整 logo(公开文件 filename)
|
||||
private String wholeLogo;
|
||||
/// 客服/商务微信号(站点展示用, 非支付通道配置)
|
||||
private String companyWechat;
|
||||
|
||||
/// 系统简化 logo(公开文件 filename)
|
||||
private String simpleLogo;
|
||||
/// 系统亮色 logo(公开文件 filename)
|
||||
private String logo;
|
||||
|
||||
/// 系统暗色 logo(公开文件 filename, 不传则复用亮色)
|
||||
private String logoDark;
|
||||
|
||||
/// 工信部 ICP 备案信息
|
||||
private String icpInfo;
|
||||
@@ -56,7 +60,4 @@ public class PlatformWebsiteConfig {
|
||||
|
||||
/// 版权信息
|
||||
private String copyright;
|
||||
|
||||
/// 版权信息链接
|
||||
private String copyrightLink;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package cn.daxpay.open.platform.system.param.config.infra;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -13,51 +16,60 @@ import lombok.experimental.Accessors;
|
||||
@Schema(title = "平台站点配置参数")
|
||||
public class PlatformWebsiteConfigParam {
|
||||
|
||||
@Size(max = 50, message = "{validation.field.systemName.size}")
|
||||
@Schema(description = "系统名称")
|
||||
private String systemName;
|
||||
|
||||
@Size(max = 100, message = "{validation.field.companyName.size}")
|
||||
@Schema(description = "公司全称")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "公司电话")
|
||||
private String companyPhone;
|
||||
|
||||
@Email(message = "{validation.field.companyEmail.email}")
|
||||
@Schema(description = "公司邮箱")
|
||||
private String companyEmail;
|
||||
|
||||
@Schema(description = "系统完整 logo")
|
||||
private String wholeLogo;
|
||||
@Size(max = 50, message = "{validation.field.companyWechat.size}")
|
||||
@Schema(description = "客服/商务微信号")
|
||||
private String companyWechat;
|
||||
|
||||
@Schema(description = "系统简化 logo")
|
||||
private String simpleLogo;
|
||||
@Schema(description = "系统亮色 logo")
|
||||
private String logo;
|
||||
|
||||
@Schema(description = "系统暗色 logo, 不传则复用亮色")
|
||||
private String logoDark;
|
||||
|
||||
@Schema(description = "工信部 ICP 备案信息")
|
||||
private String icpInfo;
|
||||
|
||||
@Pattern(regexp = "^$|^https?://.+$", message = "{validation.field.icpLink.pattern}")
|
||||
@Schema(description = "工信部 ICP 链接地址")
|
||||
private String icpLink;
|
||||
|
||||
@Schema(description = "公网安备案信息")
|
||||
private String mpsInfo;
|
||||
|
||||
@Pattern(regexp = "^$|^https?://.+$", message = "{validation.field.mpsLink.pattern}")
|
||||
@Schema(description = "公网安备案链接地址")
|
||||
private String mpsLink;
|
||||
|
||||
@Schema(description = "中国支付清算协会备案信息")
|
||||
private String pcacInfo;
|
||||
|
||||
@Pattern(regexp = "^$|^https?://.+$", message = "{validation.field.pcacLink.pattern}")
|
||||
@Schema(description = "中国支付清算协会备案链接地址")
|
||||
private String pcacLink;
|
||||
|
||||
@Schema(description = "电信增值业务许可信息")
|
||||
private String icpPlusInfo;
|
||||
|
||||
@Pattern(regexp = "^$|^https?://.+$", message = "{validation.field.icpPlusLink.pattern}")
|
||||
@Schema(description = "电信增值业务许可链接地址")
|
||||
private String icpPlusLink;
|
||||
|
||||
@Size(max = 200, message = "{validation.field.copyright.size}")
|
||||
@Schema(description = "版权信息")
|
||||
private String copyright;
|
||||
|
||||
@Schema(description = "版权信息链接")
|
||||
private String copyrightLink;
|
||||
}
|
||||
|
||||
@@ -23,11 +23,14 @@ public class PlatformWebsiteConfigResult {
|
||||
@Schema(description = "公司邮箱")
|
||||
private String companyEmail;
|
||||
|
||||
@Schema(description = "系统完整 logo")
|
||||
private String wholeLogo;
|
||||
@Schema(description = "客服/商务微信号")
|
||||
private String companyWechat;
|
||||
|
||||
@Schema(description = "系统简化 logo")
|
||||
private String simpleLogo;
|
||||
@Schema(description = "系统亮色 logo")
|
||||
private String logo;
|
||||
|
||||
@Schema(description = "系统暗色 logo, 不传则复用亮色")
|
||||
private String logoDark;
|
||||
|
||||
@Schema(description = "工信部 ICP 备案信息")
|
||||
private String icpInfo;
|
||||
@@ -56,6 +59,7 @@ public class PlatformWebsiteConfigResult {
|
||||
@Schema(description = "版权信息")
|
||||
private String copyright;
|
||||
|
||||
@Schema(description = "版权信息链接")
|
||||
private String copyrightLink;
|
||||
/// 配置内容哈希(只读, 不入库; 供客户端缓存比对, 一致则跳过 re-apply)
|
||||
@Schema(description = "配置内容哈希, 供客户端缓存比对")
|
||||
private String contentHash;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package cn.daxpay.open.platform.system.service.config.infra;
|
||||
|
||||
import cn.daxpay.open.platform.common.json.util.JacksonUtil;
|
||||
import cn.daxpay.open.platform.system.convert.config.infra.PlatformWebsiteConfigConvert;
|
||||
import cn.daxpay.open.platform.system.entity.config.platform.SystemPlatformConfig;
|
||||
import cn.daxpay.open.platform.system.entity.config.platform.infra.PlatformWebsiteConfig;
|
||||
import cn.daxpay.open.platform.system.enums.PlatformConfigTypeEnum;
|
||||
import cn.daxpay.open.platform.system.param.config.infra.PlatformWebsiteConfigParam;
|
||||
import cn.daxpay.open.platform.system.result.config.infra.PlatformWebsiteConfigResult;
|
||||
import cn.daxpay.open.platform.system.service.config.SystemPlatformConfigService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -27,9 +31,16 @@ public class PlatformWebsiteConfigService {
|
||||
new PlatformWebsiteConfig());
|
||||
}
|
||||
|
||||
/// 获取站点配置
|
||||
/// 获取站点配置(含 contentHash, 供客户端缓存比对)
|
||||
public PlatformWebsiteConfigResult findWebsiteConfig() {
|
||||
return PlatformWebsiteConfigConvert.CONVERT.toResult(this.getWebsiteConfig());
|
||||
// 确保配置行存在
|
||||
PlatformWebsiteConfig config = this.getWebsiteConfig();
|
||||
PlatformWebsiteConfigResult result = PlatformWebsiteConfigConvert.CONVERT.toResult(config);
|
||||
if (result == null) {
|
||||
result = new PlatformWebsiteConfigResult();
|
||||
}
|
||||
result.setContentHash(this.computeContentHash());
|
||||
return result;
|
||||
}
|
||||
|
||||
/// 更新站点配置(整包覆盖, 允许清空字段)
|
||||
@@ -40,4 +51,14 @@ public class PlatformWebsiteConfigService {
|
||||
}
|
||||
systemConfigService.updateConfig(PlatformConfigTypeEnum.WEBSITE, data);
|
||||
}
|
||||
|
||||
/// 对入库 configData 原文做 MD5, 写什么 hash 什么; 空配置用空对象 JSON
|
||||
private String computeContentHash() {
|
||||
SystemPlatformConfig entity = systemConfigService.getConfigEntity(PlatformConfigTypeEnum.WEBSITE);
|
||||
String raw = entity != null ? entity.getConfigData() : null;
|
||||
if (StrUtil.isBlank(raw)) {
|
||||
raw = JacksonUtil.toJson(new PlatformWebsiteConfig());
|
||||
}
|
||||
return DigestUtil.md5Hex(raw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user