1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.talentcard.server.request;
 
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
 
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
 
@Schema(name = "后台票包保存请求", description = "后台录入或修改票包信息")
public record TicketPackageSaveRequest(
        @Schema(description = "票包名称", example = "人才观影票包", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotBlank(message = "票包名称不能为空")
        @Size(max = 128, message = "票包名称长度不能超过128")
        String packageName,
 
        @Schema(description = "票包数量", example = "888")
        @NotNull(message = "票包数量不能为空")
        @Min(value = 1, message = "票包数量必须为正整数")
        Integer totalQuantity,
 
        @Schema(description = "指定兑换商家ID", example = "1")
        Long merchantId,
 
        @Schema(description = "适用商家ID列表;为空时兼容使用merchantId", example = "[1,2]")
        List<Long> merchantIds,
 
        @Schema(description = "封面图", example = "/static/entertainment-assets/wanda-cinema.webp")
        @Size(max = 500, message = "封面图长度不能超过500")
        String coverUrl,
 
        @Schema(description = "适用人才卡等级;不传或空数组表示全部", example = "[\"卓越人才卡\",\"杰出人才卡\"]")
        List<String> talentLevels,
 
        @Schema(description = "领取价", example = "0")
        @DecimalMin(value = "0.00", message = "领取价不能小于0")
        BigDecimal claimPrice,
 
        @Schema(description = "单用户周期内限领数量;不传默认1", example = "1")
        @Min(value = 1, message = "单用户限领数量必须大于0")
        Integer perUserLimit,
 
        @Schema(description = "有效开始日期", example = "2026-08-01")
        LocalDate validStart,
 
        @Schema(description = "有效结束日期", example = "2026-12-31")
        LocalDate validEnd,
 
        @Schema(description = "指定商家APP名称", example = "万达电影APP")
        @Size(max = 128, message = "指定商家APP名称长度不能超过128")
        String appName,
 
        @Schema(description = "指定商家APP或H5跳转地址", example = "https://example.com/ticket")
        @Size(max = 500, message = "跳转地址长度不能超过500")
        String appJumpUrl,
 
        @Schema(description = "使用说明", example = "领取兑换码后到指定商家APP中换取电影票")
        @Size(max = 500, message = "使用说明长度不能超过500")
        String usageText,
 
        @Schema(description = "状态:1启用,0停用;不传默认启用", example = "1")
        Integer status,
 
        @Schema(description = "排序号", example = "10")
        Integer sortNo,
 
        @Schema(description = "每个票包按人才等级配置的可领数量和重置周期")
        List<@Valid TicketPackageLevelRuleRequest> levelRules
) {
        public record TicketPackageLevelRuleRequest(
                @Schema(description = "人才卡等级", example = "卓越人才卡")
                @NotBlank(message = "人才卡等级不能为空")
                String talentLevel,
 
                @Schema(description = "是否启用:1启用,0停用", example = "1")
                Integer enabled,
 
                @Schema(description = "可领数量", example = "2")
                @NotNull(message = "可领数量不能为空")
                @Min(value = 1, message = "可领数量必须大于0")
                Integer claimableCount,
 
                @Schema(description = "重置周期:每天/每周/每月/每年", example = "每天")
                @Size(max = 32, message = "重置周期长度不能超过32")
                String resetCycle
        ) {
        }
}