fix: repair decompiled sources and add exhaustive documentation

- restore generic signatures, scoped variables and missing code from original bytecode
- remove decompiler artifacts and document classes, methods, fields and packages
- restore resources, add Batik/BouncyCastle dependencies and build/runtime docs
This commit is contained in:
rick committed 2026-11-16 17:28:23 +08:00
1 parent 9d7e42eda8
commit 10aa1829f5
346 files changed
+42404 -622

No files matched your search

@@ -8,30 +8,113 @@ import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 【MongoDB 文档实体】{@code MessageLog}
*
* 类职责:
* <ul>
* <li>作为 MongoDB 集合文档,承载该领域对象的持久化字段与索引。</li>
* <li>通过字段/依赖注入持有运行期状态,字段含义见下方“核心字段”。</li>
* </ul>
*
* 核心字段(按声明顺序):
* <ul>
* <li>{@code uuid}(UUID):对象唯一标识(MongoDB 主键)</li>
* <li>{@code message}(NewsMessage):消息</li>
* <li>{@code reader}(User):字段 reader</li>
* <li>{@code siteUuid}(UUID):用户所属站点 UUID</li>
* <li>{@code readDate}(Date):读取日期</li>
* <li>{@code isCheck}(boolean):判断是否检查</li>
* </ul>
*
* 协作对象:{@code NewsMessage、User}。
*
* 持久化/框架标记:{@code @Document} 映射为 MongoDB 集合。
*
* 学习提示:先看字段与 @Field/@Indexed,再看对应 Service/Repository 如何构造查询条件。
*/
@Document
public class MessageLog {
/**
* 对象唯一标识(MongoDB 主键);MongoDB 主键。
*
* 注解:{@code @Id}。
*/
@Id
private UUID uuid;
/**
* 消息;以 DBRef 引用其他文档。
*
* 注解:{@code @DBRef}。
*/
@DBRef
private NewsMessage message;
/**
* 字段 reader;以 DBRef 引用其他文档。
*
* 注解:{@code @DBRef}。
*/
@DBRef
private User reader;
/**
* 用户所属站点 UUID;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private UUID siteUuid;
/**
* 读取日期;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private Date readDate;
/**
* 判断是否检查;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private boolean isCheck;
/**
* 判断是否读取;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private boolean isRead;
/**
* 检查日期;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private Date checkDate;
/**
* 时间字段;建有索引,常用于查询条件。
*
* 注解:{@code @Indexed}。
*/
@Indexed
private Date notified;
/**
* 构造 {@code MessageLog} 实例。
* 使用默认字段值,后续通常由 Spring/Mongo 或调用方填充。
*/
public MessageLog() {
}
/**
* 构造 {@code MessageLog} 实例。
*
* 实现要点:主要调用:new Date。
*
* @param message 消息内容({@code NewsMessage})
* @param reader 参数 {@code reader}({@code User})
* @param siteUuid 站点 UUID({@code UUID})
*/
public MessageLog(NewsMessage message, User reader, UUID siteUuid) {
this.uuid = UUID.randomUUID();
this.message = message;
@@ -41,6 +124,15 @@ public class MessageLog {
this.notified = new Date();
}
/**
* 构造 {@code MessageLog} 实例。
*
* 实现要点:主要调用:new User、new Date。
*
* @param message 消息内容({@code NewsMessage})
* @param userUuid 用户 UUID({@code UUID})
* @param siteUuid 站点 UUID({@code UUID})
*/
public MessageLog(NewsMessage message, UUID userUuid, UUID siteUuid) {
this.uuid = UUID.randomUUID();
this.message = message;
@@ -50,74 +142,155 @@ public class MessageLog {
this.notified = new Date();
}
/**
* 获取 {@code uuid}。
* @return UUID
*/
public UUID getUuid() {
return this.uuid;
}
/**
* 设置 {@code uuid}。
*
* @param uuid 对象 UUID({@code UUID})
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* 获取 {@code message}。
* @return 字段/派生属性 {@code message} 的值
*/
public NewsMessage getMessage() {
return this.message;
}
/**
* 设置 {@code message}。
*
* @param message 消息内容({@code NewsMessage})
*/
public void setMessage(NewsMessage message) {
this.message = message;
}
/**
* 获取 {@code reader}。
* @return 用户对象;未找到时返回 {@code null}
*/
public User getReader() {
return this.reader;
}
/**
* 设置 {@code reader}。
*
* @param reader 参数 {@code reader}({@code User})
*/
public void setReader(User reader) {
this.reader = reader;
}
/**
* 判断 {@code check}。
* @return 字段/派生属性 {@code check} 的值
*/
public boolean isCheck() {
return this.isCheck;
}
/**
* 设置 {@code check}。
*
* @param isCheck 参数 {@code isCheck}({@code boolean})
*/
public void setCheck(boolean isCheck) {
this.isCheck = isCheck;
}
/**
* 判断 {@code read}。
* @return 字段/派生属性 {@code read} 的值
*/
public boolean isRead() {
return this.isRead;
}
/**
* 设置 {@code read}。
*
* @param isRead 参数 {@code isRead}({@code boolean})
*/
public void setRead(boolean isRead) {
this.isRead = isRead;
}
/**
* 获取 {@code siteUuid}。
* @return UUID
*/
public UUID getSiteUuid() {
return this.siteUuid;
}
/**
* 设置 {@code siteUuid}。
*
* @param siteUuid 站点 UUID({@code UUID})
*/
public void setSiteUuid(UUID siteUuid) {
this.siteUuid = siteUuid;
}
/**
* 获取 {@code notified}。
* @return 字段/派生属性 {@code notified} 的值
*/
public Date getNotified() {
return this.notified;
}
/**
* 设置 {@code notified}。
*
* @param notified 参数 {@code notified}({@code Date})
*/
public void setNotified(Date notified) {
this.notified = notified;
}
/**
* 获取 {@code readDate}。
* @return 字段/派生属性 {@code readDate} 的值
*/
public Date getReadDate() {
return this.readDate;
}
/**
* 设置 {@code readDate}。
*
* @param readDate 参数 {@code readDate}({@code Date})
*/
public void setReadDate(Date readDate) {
this.readDate = readDate;
}
/**
* 获取 {@code checkDate}。
* @return 字段/派生属性 {@code checkDate} 的值
*/
public Date getCheckDate() {
return this.checkDate;
}
/**
* 设置 {@code checkDate}。
*
* @param checkDate 参数 {@code checkDate}({@code Date})
*/
public void setCheckDate(Date checkDate) {
this.checkDate = checkDate;
}
@@ -18,37 +18,124 @@ import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.mail.internet.InternetAddress;
/**
* 【MongoDB 文档实体】{@code NewsMessage}
*
* 类职责:
* <ul>
* <li>作为 MongoDB 集合文档,承载该领域对象的持久化字段与索引。</li>
* <li>通过字段/依赖注入持有运行期状态,字段含义见下方“核心字段”。</li>
* </ul>
*
* 核心字段(按声明顺序):
* <ul>
* <li>{@code uuid}(UUID):对象唯一标识(MongoDB 主键)</li>
* <li>{@code writer}(User):字段 writer</li>
* <li>{@code category}(String):字段 category</li>
* <li>{@code forWhat}(String):用于What</li>
* <li>{@code reference}(DbObject):字段 reference</li>
* <li>{@code message}(DbObject):消息</li>
* </ul>
*
* 协作对象:{@code User、DbObject}。
*
* 持久化/框架标记:{@code @Document} 映射为 MongoDB 集合。
*
* 学习提示:先看字段与 @Field/@Indexed,再看对应 Service/Repository 如何构造查询条件。
*/
@Document
public class NewsMessage {
/**
* 对象唯一标识(MongoDB 主键);MongoDB 主键。
*
* 注解:{@code @Id}。
*/
@Id
private UUID uuid;
/**
* 字段 writer;以 DBRef 引用其他文档。
*
* 注解:{@code @DBRef}。
*/
@DBRef
private User writer;
/**
* 字段 category。
*/
private String category;
/**
* 用于What。
*/
private String forWhat;
/**
* 字段 reference。
*/
private DbObject reference;
/**
* 消息。
*/
private DbObject message;
/**
* 判断是否Unremovable。
*/
private Boolean isUnremovable;
/**
* 判断是否Enabled。
*/
private Boolean isEnabled;
/**
* 发送调度。
*/
private Date sendSchedule;
/**
* 时间字段。
*/
private Date expiry;
/**
* 发送Now;不持久化到 MongoDB,仅运行时使用。
*
* 注解:{@code @Transient}。
*/
@Transient
private boolean sendNow;
/**
* 创建时间。
*/
private Date created;
/**
* 最后更新时间。
*/
private Date updated;
/**
* 构造 {@code NewsMessage} 实例。
*
* @param device 设备({@code Device})
* @param category 分类(app/ota/other/report 等)({@code String})
*/
public NewsMessage(Device device, String category) {
this.init();
this.category = "device_" + category;
this.reference.put("uuid", device.getUuid());
}
/**
* 构造 {@code NewsMessage} 实例。
*
* @param device 设备({@code Device})
*/
public NewsMessage(Device device) {
this.init();
this.reference.put("uuid", device.getUuid());
}
/**
* 构造 {@code NewsMessage} 实例。
*
* @param packet WebSocket 报文({@code MidmPacket})
*/
public NewsMessage(MidmPacket packet) {
MidmQuery query = packet.getQuery();
this.setUuid(query.getUuid());
@@ -62,16 +149,31 @@ public class NewsMessage {
this.getReference().put("query", query.getQuery());
}
/**
* 构造 {@code NewsMessage} 实例。
* 使用默认字段值,后续通常由 Spring/Mongo 或调用方填充。
*/
public NewsMessage() {
this.init();
}
/**
* 初始化对象状态(补齐 UUID/时间戳/默认字段)。
*
* 实现要点:主要调用:new Date。
*/
public void init() {
this.uuid = UUID.randomUUID();
this.created = new Date();
this.updated = this.created;
}
/**
* 获取 {@code message}。
*
* 实现要点:包含 1 个条件分支、0 个循环;主要调用:new DbObject。
* @return MongoDB 文档扩展对象
*/
public DbObject getMessage() {
if (this.message == null) {
this.message = new DbObject();
@@ -80,17 +182,32 @@ public class NewsMessage {
return this.message;
}
/**
* 获取消息。
*
* @param locale 参数 {@code locale}({@code Locale})
* @return MongoDB 文档扩展对象
*/
public DbObject getMessage(Locale locale) {
return this.getMessage(locale.toLanguageTag());
}
/**
* 获取消息。
*
* 实现要点:包含异常捕获与降级/回滚分支;包含 4 个条件分支、2 个循环;主要调用:new DbObject。
*
* @param languageTag 参数 {@code languageTag}({@code String})
* @return MongoDB 文档扩展对象
*/
public DbObject getMessage(String languageTag) {
DbObject message = this.getMessage();
DbObject localedMessage = new DbObject();
if (message.get(languageTag) == null) {
message.put(languageTag, localedMessage);
} else if (message.get(languageTag) instanceof LinkedTreeMap) {
for(Map.Entry entry : ((LinkedTreeMap)message.get(languageTag)).entrySet()) {
for(Object entryObject : ((LinkedTreeMap)message.get(languageTag)).entrySet()) {
Map.Entry entry = (Map.Entry)entryObject;
localedMessage.append((String)entry.getKey(), entry.getValue());
}
@@ -109,83 +226,186 @@ public class NewsMessage {
return localedMessage;
}
/**
* 设置 {@code message}。
*
* @param message 消息内容({@code DbObject})
*/
public void setMessage(DbObject message) {
this.message = message;
}
/**
* 设置消息。
*
* @param title 参数 {@code title}({@code String})
* @param content 参数 {@code content}({@code String})
*/
public void setMessage(String title, String content) {
this.setTitle(title);
this.setContent(content);
}
/**
* 获取 {@code title}。
* @return 字符串结果
*/
public String getTitle() {
return this.getMessage("en-US").getString("title");
}
/**
* 获取 {@code summary}。
* @return 字符串结果
*/
public String getSummary() {
return this.getMessage().getString("summary");
}
/**
* 判断 {@code content}。
* @return 字段/派生属性 {@code content} 的值
*/
public boolean hasContent() {
return this.getMessage().containsKey("content");
}
/**
* 获取 {@code content}。
* @return 字符串结果
*/
public String getContent() {
return this.getMessage("en-US").getString("content");
}
/**
* 获取Title。
*
* @param locale 参数 {@code locale}({@code String})
* @return 字符串结果
*/
public String getTitle(String locale) {
return this.getMessage(locale).getString("title");
}
/**
* 获取Summary。
*
* @param locale 参数 {@code locale}({@code String})
* @return 字符串结果
*/
public String getSummary(String locale) {
return this.getMessage(locale).getString("summary");
}
/**
* 判断是否Content。
*
* @param locale 参数 {@code locale}({@code String})
* @return 字段/派生属性 {@code content} 的值
*/
public boolean hasContent(String locale) {
return this.getMessage(locale).containsKey("content");
}
/**
* 获取Content。
*
* @param locale 参数 {@code locale}({@code String})
* @return 字符串结果
*/
public String getContent(String locale) {
return this.getMessage(locale).getString("content");
}
public List getMailsTo() {
/**
* 获取 {@code mailsTo}。
* @return InternetAddress列表,可能为空
*/
public List<InternetAddress> getMailsTo() {
return McEmailUtils.parseMails(this.getMessage().getString("to"));
}
/**
* 设置消息。
*
* @param title 参数 {@code title}({@code String})
* @param content 参数 {@code content}({@code String})
* @param summary 参数 {@code summary}({@code String})
*/
public void setMessage(String title, String content, String summary) {
this.setMessage(Locale.US.toLanguageTag(), title, content, summary);
}
/**
* 设置消息。
*
* @param languageTag 参数 {@code languageTag}({@code String})
* @param title 参数 {@code title}({@code String})
* @param content 参数 {@code content}({@code String})
* @param summary 参数 {@code summary}({@code String})
*/
public void setMessage(String languageTag, String title, String content, String summary) {
this.setTitle(languageTag, title);
this.setContent(languageTag, content);
this.setSummary(languageTag, summary);
}
/**
* 设置 {@code title}。
*
* @param title 参数 {@code title}({@code String})
*/
public void setTitle(String title) {
this.setTitle(Locale.US.toLanguageTag(), title);
}
/**
* 设置 {@code content}。
*
* @param content 参数 {@code content}({@code String})
*/
public void setContent(String content) {
this.setContent(Locale.US.toLanguageTag(), content);
}
/**
* 设置 {@code summary}。
*
* @param summary 参数 {@code summary}({@code String})
*/
public void setSummary(String summary) {
this.setSummary(Locale.US.toLanguageTag(), summary);
}
/**
* 设置Title。
*
* @param languageTag 参数 {@code languageTag}({@code String})
* @param title 参数 {@code title}({@code String})
*/
public void setTitle(String languageTag, String title) {
DbObject message = this.getMessage(languageTag);
message.put("title", title);
}
/**
* 设置Content。
*
* @param languageTag 参数 {@code languageTag}({@code String})
* @param content 参数 {@code content}({@code String})
*/
public void setContent(String languageTag, String content) {
DbObject message = this.getMessage(languageTag);
message.put("content", content);
}
/**
* 获取 {@code reference}。
*
* 实现要点:包含 1 个条件分支、0 个循环;主要调用:new DbObject。
* @return MongoDB 文档扩展对象
*/
public DbObject getReference() {
if (this.reference == null) {
this.reference = new DbObject();
@@ -194,111 +414,240 @@ public class NewsMessage {
return this.reference;
}
/**
* 设置 {@code reference}。
*
* @param reference 参数 {@code reference}({@code DbObject})
*/
public void setReference(DbObject reference) {
this.reference = reference;
}
/**
* 设置Summary。
*
* @param languageTag 参数 {@code languageTag}({@code String})
* @param summary 参数 {@code summary}({@code String})
*/
public void setSummary(String languageTag, String summary) {
DbObject message = this.getMessage(languageTag);
message.put("summary", summary);
}
/**
* 判断 {@code unremovable}。
* @return 字段/派生属性 {@code unremovable} 的值
*/
public Boolean isUnremovable() {
return this.isUnremovable;
}
/**
* 设置 {@code isUnremovable}。
*
* @param isUnremovable 参数 {@code isUnremovable}({@code Boolean})
*/
public void setIsUnremovable(Boolean isUnremovable) {
this.isUnremovable = isUnremovable;
}
/**
* 获取 {@code forWhat}。
* @return 字符串结果
*/
public String getForWhat() {
return this.forWhat;
}
/**
* 设置 {@code forWhat}。
*
* @param forWhat 参数 {@code forWhat}({@code String})
*/
public void setForWhat(String forWhat) {
this.forWhat = forWhat;
}
/**
* 获取 {@code uuid}。
* @return UUID
*/
public UUID getUuid() {
return this.uuid;
}
/**
* 设置 {@code uuid}。
*
* @param uuid 对象 UUID({@code UUID})
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* 获取 {@code writer}。
* @return 用户对象;未找到时返回 {@code null}
*/
public User getWriter() {
return this.writer;
}
/**
* 设置 {@code writer}。
*
* @param writer 参数 {@code writer}({@code User})
*/
public void setWriter(User writer) {
this.writer = writer;
}
/**
* 获取 {@code category}。
* @return 字符串结果
*/
public String getCategory() {
return this.category;
}
/**
* 设置 {@code category}。
*
* @param category 分类(app/ota/other/report 等)({@code String})
*/
public void setCategory(String category) {
this.category = category;
}
/**
* 获取 {@code sendSchedule}。
* @return 字段/派生属性 {@code sendSchedule} 的值
*/
public Date getSendSchedule() {
return this.sendSchedule;
}
/**
* 设置 {@code sendSchedule}。
*
* @param sendSchedule 参数 {@code sendSchedule}({@code Date})
*/
public void setSendSchedule(Date sendSchedule) {
this.sendSchedule = sendSchedule;
}
/**
* 发送Now。
*
* 实现要点:主要调用:new DateTime。
* @return 条件成立返回 {@code true},否则返回 {@code false}
*/
public boolean sendNow() {
return this.sendNow || this.sendSchedule == null || McDateTimeUtils.isSameDate(new DateTime(this.sendSchedule), DateTime.now());
}
/**
* 获取 {@code expiry}。
* @return 字段/派生属性 {@code expiry} 的值
*/
public Date getExpiry() {
return this.expiry;
}
/**
* 设置 {@code expiry}。
*
* @param expiry 参数 {@code expiry}({@code Date})
*/
public void setExpiry(Date expiry) {
this.expiry = expiry;
}
/**
* 获取 {@code created}。
* @return 字段/派生属性 {@code created} 的值
*/
public Date getCreated() {
return this.created;
}
/**
* 设置 {@code created}。
*
* @param created 参数 {@code created}({@code Date})
*/
public void setCreated(Date created) {
this.created = created;
}
/**
* 获取 {@code updated}。
* @return 字段/派生属性 {@code updated} 的值
*/
public Date getUpdated() {
return this.updated;
}
/**
* 设置 {@code updated}。
*
* @param updated 参数 {@code updated}({@code Date})
*/
public void setUpdated(Date updated) {
this.updated = updated;
}
/**
* 获取 {@code isUnremovable}。
* @return 字段/派生属性 {@code isUnremovable} 的值
*/
public Boolean getIsUnremovable() {
return this.isUnremovable;
}
/**
* 判断 {@code enabled}。
* @return 字段/派生属性 {@code enabled} 的值
*/
public Boolean isEnabled() {
return this.isEnabled;
}
/**
* 设置 {@code isEnabled}。
*
* @param isEnabled 参数 {@code isEnabled}({@code Boolean})
*/
public void setIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
}
/**
* 判断 {@code sendNow}。
* @return 字段/派生属性 {@code sendNow} 的值
*/
public boolean isSendNow() {
return this.sendNow;
}
/**
* 设置 {@code sendNow}。
*
* @param sendNow 参数 {@code sendNow}({@code boolean})
*/
public void setSendNow(boolean sendNow) {
this.sendNow = sendNow;
}
/**
* 处理转换为日期String。
*
* 实现要点:主要调用:new DateTime。
*
* @param dateString 参数 {@code dateString}({@code String})
* @param format 参数 {@code format}({@code String})
* @return 字符串结果
*/
public String toDateString(String dateString, String format) {
DateTime dateTime = new DateTime(dateString);
return McDateTimeUtils.toString(dateTime, format);
@@ -0,0 +1,13 @@
/**
* 新闻/通知消息模型。
*
* <p>本包主要类型:
* <ul>
* <li>{@link MessageLog}</li>
* <li>{@link NewsMessage}</li>
* </ul>
*
* <p>阅读建议:结合本包内类的 Javadoc 与 {@code docs/CODE_WALKTHROUGH.md} 一起看,
* 先理解输入/输出,再跟踪 Service 与 MongoTemplate 的调用链。
*/
package com.midm.model.news;