feat(notify): 支持批量授权记录及景区模板查询

- 新增批量授权记录接口,支持一次请求处理多个模板ID
- 新增查询景区通知模板及用户授权余额接口
- 修改授权记录请求体,将单个templateId改为templateIds列表
- 增加授权记录响应结构,区分成功与失败记录
- 新增通知授权工具类,封装常用授权检查与消费方法
- 使用JwtTokenUtil获取当前用户ID替代BaseContextHandler
- 移除过时的BaseContextHandler导入及相关代码依赖
This commit is contained in:
2025-10-15 09:41:18 +08:00
parent 86d5f8ceb1
commit c80086ba69
7 changed files with 520 additions and 59 deletions

View File

@@ -44,6 +44,16 @@ public interface UserNotificationAuthorizationService {
*/
UserNotificationAuthorizationEntity recordAuthorization(Long memberId, String templateId, Long scenicId);
/**
* 批量记录用户授权
*
* @param memberId 用户ID
* @param templateIds 模板ID列表
* @param scenicId 景区ID
* @return 批量授权记录结果
*/
List<AuthorizationRecord> batchRecordAuthorization(Long memberId, List<String> templateIds, Long scenicId);
/**
* 消费一次授权
*
@@ -106,6 +116,50 @@ public interface UserNotificationAuthorizationService {
*/
AuthorizationStats getAuthorizationStats(Long memberId);
/**
* 授权记录结果
*/
class AuthorizationRecord {
private boolean success; // 是否成功
private String templateId; // 模板ID
private Long id; // 记录ID
private Long scenicId; // 景区ID
private Integer authorizationCount; // 授权次数
private Integer consumedCount; // 已消费次数
private Integer remainingCount; // 剩余次数
private Date lastAuthorizedTime; // 最后授权时间
private Date lastConsumedTime; // 最后消费时间
private Integer status; // 状态
private Date createTime; // 创建时间
private String failureReason; // 失败原因
// getters and setters
public boolean isSuccess() { return success; }
public void setSuccess(boolean success) { this.success = success; }
public String getTemplateId() { return templateId; }
public void setTemplateId(String templateId) { this.templateId = templateId; }
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public Long getScenicId() { return scenicId; }
public void setScenicId(Long scenicId) { this.scenicId = scenicId; }
public Integer getAuthorizationCount() { return authorizationCount; }
public void setAuthorizationCount(Integer authorizationCount) { this.authorizationCount = authorizationCount; }
public Integer getConsumedCount() { return consumedCount; }
public void setConsumedCount(Integer consumedCount) { this.consumedCount = consumedCount; }
public Integer getRemainingCount() { return remainingCount; }
public void setRemainingCount(Integer remainingCount) { this.remainingCount = remainingCount; }
public Date getLastAuthorizedTime() { return lastAuthorizedTime; }
public void setLastAuthorizedTime(Date lastAuthorizedTime) { this.lastAuthorizedTime = lastAuthorizedTime; }
public Date getLastConsumedTime() { return lastConsumedTime; }
public void setLastConsumedTime(Date lastConsumedTime) { this.lastConsumedTime = lastConsumedTime; }
public Integer getStatus() { return status; }
public void setStatus(Integer status) { this.status = status; }
public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; }
public String getFailureReason() { return failureReason; }
public void setFailureReason(String failureReason) { this.failureReason = failureReason; }
}
/**
* 授权统计信息DTO
*/