feat(oapi): /oapi/site/list 下发站点主题 theme+themeParams(T1)——SiteOptionVo 扩两字段 raw 透传(theme 空=default、themeParams=config_json.theme_params 原样键值、未配=空对象),ExtJsonUtils 解析对齐 PortalSiteSnapshot 风格;SiteOapiIT 冻结新契约(demo1 campus-glow、demo2 兜底形态)

This commit is contained in:
chenxing
2026-10-03 13:43:36 +08:00
parent 84224b31bb
commit 55d80e21a4
2 changed files with 48 additions and 2 deletions
@@ -2,6 +2,7 @@ package com.yunhai.cms.controller.oapi.site;
import com.yunhai.cms.entity.CmsSite;
import com.yunhai.cms.repository.CmsSiteRepository;
import com.yunhai.cms.utils.ExtJsonUtils;
import com.yunhai.platform.apistd.BizException;
import com.yunhai.platform.utils.exception.ErrorCode;
import lombok.Data;
@@ -11,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 站点目录开放接口(/oapi/site/list,appKey 签名访问;V2.0 Part C.3)。
@@ -51,14 +54,34 @@ public class SiteOapiController {
vo.setSiteCode(site.getCode());
vo.setName(site.getName());
vo.setSchId(site.getSchId() == null ? null : site.getSchId().longValue());
// T1 主题联动(2026-10-03):theme 空=default;themeParams=config_json.theme_params
// 原样键值(解析写法对齐 PortalSiteSnapshot.of),未配=空对象(消费方免判空两写)
vo.setTheme(site.getTheme() == null || site.getTheme().isEmpty()
? "default" : site.getTheme());
Map<String, Object> config = ExtJsonUtils.parse(site.getConfigJson());
Object tp = config == null ? null : config.get("theme_params");
Map<String, String> params = new LinkedHashMap<>();
if (tp instanceof Map) {
for (Map.Entry<?, ?> e : ((Map<?, ?>) tp).entrySet()) {
if (e.getKey() != null && e.getValue() != null) {
params.put(String.valueOf(e.getKey()), String.valueOf(e.getValue()));
}
}
}
vo.setThemeParams(params);
return vo;
}
/** 站点选项(siteCode 为办事大厅侧定位键;schId 用于权限与租户定界) */
/** 站点选项(siteCode 为办事大厅侧定位键;schId 用于权限与租户定界;
* theme/themeParams raw 透传——消费方(svc-hall hall 用户面)按皮肤声明自行过滤) */
@Data
public static class SiteOptionVo {
private String siteCode;
private String name;
private Long schId;
/** CMS 皮肤包名(空已兜底为 default) */
private String theme;
/** CMS config_json.theme_params 原样键值(未配置=空对象) */
private Map<String, String> themeParams = new LinkedHashMap<>();
}
}