package com.ruoyi.message.wechat;
|
|
/**
|
* 微信公众号机构级配置(appid / appSecret / 网关地址)。
|
* <p>
|
* 现状:这些值硬编码在 {@code com.ruoyi.common.enums.WxGZHEnum} 枚举里(丽水市中医院、景宁、湖滨、吴山),
|
* 由 {@code WxGZHEnum.getDescByCode(orgid)} 返回一个按固定顺序排列的 List,
|
* 调用方靠下标 {@code get(1)/get(2)/get(3)} 取值 —— 这是很脆的写法(一旦某个机构缺 appid,
|
* 下标就会整体错位;景宁就是因为 appid 为空导致 {@code size()<4} 被跳过)。
|
* <p>
|
* 本类把下标语义显式化,避免继续用 List 下标传递。
|
*/
|
public class WechatMpConfig {
|
|
/**
|
* 机构ID
|
*/
|
private String orgid;
|
|
/**
|
* 公众号 AppID
|
*/
|
private String appid;
|
|
/**
|
* 公众号 AppSecret(参与签名)
|
*/
|
private String appSecret;
|
|
/**
|
* 公众号网关地址
|
*/
|
private String address;
|
|
/**
|
* 是否配置完整(appid/appSecret/address 都不为空)
|
*/
|
public boolean isComplete() {
|
return isNotEmpty(appid) && isNotEmpty(appSecret) && isNotEmpty(address);
|
}
|
|
private static boolean isNotEmpty(String value) {
|
return value != null && !value.trim().isEmpty();
|
}
|
|
public String getOrgid() {
|
return orgid;
|
}
|
|
public void setOrgid(String orgid) {
|
this.orgid = orgid;
|
}
|
|
public String getAppid() {
|
return appid;
|
}
|
|
public void setAppid(String appid) {
|
this.appid = appid;
|
}
|
|
public String getAppSecret() {
|
return appSecret;
|
}
|
|
public void setAppSecret(String appSecret) {
|
this.appSecret = appSecret;
|
}
|
|
public String getAddress() {
|
return address;
|
}
|
|
public void setAddress(String address) {
|
this.address = address;
|
}
|
|
@Override
|
public String toString() {
|
return "WechatMpConfig{orgid='" + orgid + '\''
|
+ ", appid='" + appid + '\''
|
+ ", appSecret='" + (appSecret == null ? null : "***") + '\''
|
+ ", address='" + address + '\''
|
+ '}';
|
}
|
}
|