ai-engineering-init 1.14.3 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/skill-forced-eval.js +1 -0
- package/.claude/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.claude/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.claude/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.claude/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/.codex/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.codex/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.codex/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.codex/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/.cursor/hooks/cursor-skill-eval.js +5 -6
- package/.cursor/rules/skill-activation.mdc +1 -2
- package/.cursor/skills/leniu-marketing-scenario/SKILL.md +448 -0
- package/.cursor/skills/leniu-marketing-scenario/references/pay-meal-rules.md +197 -0
- package/.cursor/skills/leniu-marketing-scenario/references/price-rules.md +286 -0
- package/.cursor/skills/leniu-marketing-scenario/references/recharge-rules.md +188 -0
- package/AGENTS.md +1 -0
- package/bin/index.js +445 -121
- package/package.json +1 -1
- package/.claude/skills/leniu-java-amount-handling/SKILL.md +0 -461
- package/.claude/skills/leniu-java-export/SKILL.md +0 -570
- package/.claude/skills/leniu-java-report-query-param/SKILL.md +0 -291
- package/.claude/skills/leniu-java-total-line/SKILL.md +0 -196
- package/.claude/skills/leniu-marketing-price-rule-customizer/SKILL.md +0 -301
- package/.claude/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +0 -285
- package/.claude/skills/leniu-mealtime/SKILL.md +0 -215
- package/.claude/skills/leniu-report-customization/SKILL.md +0 -415
- package/.claude/skills/leniu-report-customization/references/table-fields.md +0 -93
- package/.claude/skills/leniu-report-standard-customization/SKILL.md +0 -391
- package/.claude/skills/leniu-report-standard-customization/references/analysis-module.md +0 -64
- package/.claude/skills/leniu-report-standard-customization/references/table-fields.md +0 -113
- package/.codex/skills/leniu-java-amount-handling/SKILL.md +0 -461
- package/.codex/skills/leniu-java-export/SKILL.md +0 -570
- package/.codex/skills/leniu-java-report-query-param/SKILL.md +0 -291
- package/.codex/skills/leniu-java-total-line/SKILL.md +0 -196
- package/.codex/skills/leniu-marketing-price-rule-customizer/SKILL.md +0 -301
- package/.codex/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +0 -285
- package/.codex/skills/leniu-mealtime/SKILL.md +0 -215
- package/.codex/skills/leniu-report-customization/SKILL.md +0 -415
- package/.codex/skills/leniu-report-customization/references/table-fields.md +0 -93
- package/.codex/skills/leniu-report-standard-customization/SKILL.md +0 -391
- package/.codex/skills/leniu-report-standard-customization/references/analysis-module.md +0 -64
- package/.codex/skills/leniu-report-standard-customization/references/table-fields.md +0 -113
- package/.cursor/skills/leniu-java-amount-handling/SKILL.md +0 -461
- package/.cursor/skills/leniu-java-export/SKILL.md +0 -570
- package/.cursor/skills/leniu-java-report-query-param/SKILL.md +0 -291
- package/.cursor/skills/leniu-java-total-line/SKILL.md +0 -196
- package/.cursor/skills/leniu-marketing-price-rule-customizer/SKILL.md +0 -301
- package/.cursor/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +0 -285
- package/.cursor/skills/leniu-mealtime/SKILL.md +0 -215
- package/.cursor/skills/leniu-report-customization/SKILL.md +0 -415
- package/.cursor/skills/leniu-report-customization/references/table-fields.md +0 -93
- package/.cursor/skills/leniu-report-standard-customization/SKILL.md +0 -391
- package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +0 -64
- package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +0 -113
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# 计价规则详解(RulePriceEnum)
|
|
2
|
+
|
|
3
|
+
## 规则执行顺序
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
限次规则 → 优惠规则 → 限额规则 → 赠送规则
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
由 `RulePriceTypeDTO` 自动分类,`RulePriceResultOrderDTO` 链式调用:
|
|
10
|
+
```java
|
|
11
|
+
order.calcLimitTimesRules(...)
|
|
12
|
+
.calcDiscountRules(...)
|
|
13
|
+
.calcLimitAmountRules(...)
|
|
14
|
+
.calcGiveRules(...)
|
|
15
|
+
.calcCompleted();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 分类判断方法
|
|
19
|
+
|
|
20
|
+
```java
|
|
21
|
+
RulePriceEnum.isDiscountRule(key); // 优惠类
|
|
22
|
+
RulePriceEnum.isLimitTimesRule(key); // 限次类
|
|
23
|
+
RulePriceEnum.isLimitAmountRule(key); // 限额类
|
|
24
|
+
RulePriceEnum.isGiveRule(key); // 赠送类
|
|
25
|
+
RulePriceEnum.isDishRule(key); // 菜品类
|
|
26
|
+
RulePriceEnum.isGoodsRule(key); // 商品类
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 优惠类规则
|
|
32
|
+
|
|
33
|
+
### 1. 打折(RULE_DISCOUNT, key=1)
|
|
34
|
+
|
|
35
|
+
按消费次数梯度打折。第 N 次消费使用第 N 个折扣率。
|
|
36
|
+
|
|
37
|
+
```java
|
|
38
|
+
// DTO
|
|
39
|
+
public class PriceDiscountDTO {
|
|
40
|
+
private List<BigDecimal> items; // 折扣率列表 [0.9, 0.8, 0.7](第1次9折,第2次8折...)
|
|
41
|
+
private BigDecimal joinAmount; // 参与计算上限金额(null=不限)
|
|
42
|
+
private BigDecimal maxAmount; // 单次优惠/浮动上限金额
|
|
43
|
+
}
|
|
44
|
+
// Handler 路径
|
|
45
|
+
rule.price.handler.discount.extension.impl.DefaultPriceDiscountHandlerImpl
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. 累计减免(RULE_REDUCTION_TOTAL, key=2)
|
|
49
|
+
|
|
50
|
+
```java
|
|
51
|
+
// DTO
|
|
52
|
+
public class PriceReductionTotalDTO {
|
|
53
|
+
private BigDecimal maxAmount; // 最大累计减免金额
|
|
54
|
+
}
|
|
55
|
+
// Handler 路径
|
|
56
|
+
rule.price.handler.reductiontotal.extension.impl.DefaultReductionTotalHandlerImpl
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. 固定减免(RULE_REDUCTION_FIXED, key=4)
|
|
60
|
+
|
|
61
|
+
按消费次数梯度减免固定金额。
|
|
62
|
+
|
|
63
|
+
```java
|
|
64
|
+
// DTO
|
|
65
|
+
public class PriceReductionFixedDTO {
|
|
66
|
+
private List<BigDecimal> items; // 减免金额列表 [500, 300, 100]
|
|
67
|
+
}
|
|
68
|
+
// Handler 路径
|
|
69
|
+
rule.price.handler.reductionfixed.extension.impl.DefaultReductionFixedHandlerImpl
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. 比例扣费(RULE_DEDUCTION_RATIO, key=5)
|
|
73
|
+
|
|
74
|
+
个人钱包扣 X%,补贴钱包扣 Y%,补贴上限 Z 元。
|
|
75
|
+
|
|
76
|
+
```java
|
|
77
|
+
// DTO
|
|
78
|
+
public class PriceDeductionRatioDTO {
|
|
79
|
+
private BigDecimal personalRatio; // 个人钱包扣费比例
|
|
80
|
+
private BigDecimal subsidyRatio; // 补贴钱包扣费比例
|
|
81
|
+
private BigDecimal subsidyMaxAmount; // 补贴上限金额
|
|
82
|
+
}
|
|
83
|
+
// Handler 路径
|
|
84
|
+
rule.price.handler.deductionratio.extension.impl.DefaultDeductionRatioHandlerImpl
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 5. 固定扣费(RULE_DEDUCTION_FIXED, key=6)
|
|
88
|
+
|
|
89
|
+
按消费次数梯度固定扣费,可额外优惠。
|
|
90
|
+
|
|
91
|
+
```java
|
|
92
|
+
// DTO
|
|
93
|
+
public class PriceDeductionFixedDTO {
|
|
94
|
+
private List<PriceDeductionFixedItemDTO> items; // 含 amount + extraDiscount
|
|
95
|
+
}
|
|
96
|
+
// Handler 路径
|
|
97
|
+
rule.price.handler.deductionfixed.extension.impl.DefaultPriceDeDuctionFixedHandlerImpl
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 6. 满减满折(RULE_DEDUCTION_FULL, key=7)
|
|
101
|
+
|
|
102
|
+
满 X 元减 Y 元或打 Z 折,可限制享受次数。
|
|
103
|
+
|
|
104
|
+
```java
|
|
105
|
+
// DTO
|
|
106
|
+
public class PriceDeductionFullDTO {
|
|
107
|
+
private List<PriceDeductionFullItemDTO> items; // 含 fullAmount + discountType + discountValue + maxTimes
|
|
108
|
+
}
|
|
109
|
+
// Handler 路径
|
|
110
|
+
rule.price.handler.deductionfull.extension.impl.DefaultPriceDeDuctionFullHandlerImpl
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 7. 额外扣费(RULE_ADD_AMOUNT, key=9)
|
|
114
|
+
|
|
115
|
+
每笔消费额外扣费固定金额。
|
|
116
|
+
|
|
117
|
+
```java
|
|
118
|
+
// DTO
|
|
119
|
+
public class PriceAddAmountDTO {
|
|
120
|
+
private BigDecimal addAmount; // 额外扣费金额
|
|
121
|
+
}
|
|
122
|
+
// Handler 路径
|
|
123
|
+
rule.price.handler.addamount.extension.impl.DefaultPriceAddAmountHandlerImpl
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 赠送类规则
|
|
129
|
+
|
|
130
|
+
### 8. 固定补贴(RULE_SUBSIDY_FIXED, key=3)
|
|
131
|
+
|
|
132
|
+
每笔消费后补贴固定金额到指定钱包。
|
|
133
|
+
|
|
134
|
+
```java
|
|
135
|
+
// DTO
|
|
136
|
+
public class PriceSubsidyFixedDTO {
|
|
137
|
+
private BigDecimal subsidyAmount; // 补贴金额
|
|
138
|
+
}
|
|
139
|
+
// Handler 路径
|
|
140
|
+
rule.price.handler.subsidyfixed.extension.impl.DefaultSubsidyFixedHandlerImpl
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 9. 满额赠送(RULE_SUM_GIVE, key=8)
|
|
144
|
+
|
|
145
|
+
累计消费达到门槛金额后赠送。
|
|
146
|
+
|
|
147
|
+
```java
|
|
148
|
+
// DTO
|
|
149
|
+
public class PriceSumGiveDTO {
|
|
150
|
+
private List<PriceSumGiveItem> items; // 含 gateAmount + giveAmount
|
|
151
|
+
}
|
|
152
|
+
// Handler 路径
|
|
153
|
+
rule.price.handler.sumgive.extension.impl.DefaultSumGiveHandlerImpl
|
|
154
|
+
// MQ 异步处理
|
|
155
|
+
config.MarketSumGiveMQListener
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 限次类规则
|
|
161
|
+
|
|
162
|
+
### 10. 上限次数(RULE_LIMIT_MAX_COUNT, key=51)
|
|
163
|
+
|
|
164
|
+
日/周/月/餐次累计消费次数上限。
|
|
165
|
+
|
|
166
|
+
```java
|
|
167
|
+
// DTO
|
|
168
|
+
public class PriceLimitMaxCountDTO {
|
|
169
|
+
private Integer limitType; // 限制周期(日/周/月/季/半年/年/餐次)
|
|
170
|
+
private Integer maxCount; // 上限次数
|
|
171
|
+
private List<Integer> mealtimeTypes; // 适用餐次
|
|
172
|
+
}
|
|
173
|
+
// Handler 路径
|
|
174
|
+
rule.price.handler.limitmaxcount.extension.impl.DefaultLimitMaxCountHandlerImpl
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 11. 菜品限购(RULE_DISH_LIMIT, key=201)
|
|
178
|
+
|
|
179
|
+
```java
|
|
180
|
+
// DTO
|
|
181
|
+
public class PriceDishLimitDTO {
|
|
182
|
+
private Integer dishIdType; // 按菜品/按菜品类别
|
|
183
|
+
private List<Long> dishIds; // 菜品或类别ID列表
|
|
184
|
+
private Integer limitCount; // 限购数量
|
|
185
|
+
}
|
|
186
|
+
// Handler 路径
|
|
187
|
+
rule.price.handler.dishlimit.extension.impl.DefaultPriceDishLimitHandlerImpl
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 12. 商品限购(RULE_GOODS_LIMIT, key=301)
|
|
191
|
+
|
|
192
|
+
```java
|
|
193
|
+
// DTO 结构同 PriceDishLimitDTO
|
|
194
|
+
// Handler 路径
|
|
195
|
+
rule.price.handler.goodslimit.extension.impl.DefaultPriceGoodsLimitHandlerImpl
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 限额类规则
|
|
201
|
+
|
|
202
|
+
### 13. 单笔上限金额(RULE_LIMIT_MAX_AMOUNT, key=101)
|
|
203
|
+
|
|
204
|
+
```java
|
|
205
|
+
// DTO
|
|
206
|
+
public class PriceLimitMaxAmountDTO {
|
|
207
|
+
private BigDecimal maxAmount; // 单笔上限
|
|
208
|
+
}
|
|
209
|
+
// Handler 路径
|
|
210
|
+
rule.price.handler.limitmaxamount.extension.impl.DefaultLimitMaxAmountHandlerImpl
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 14. 累计上限金额(RULE_LIMIT_SUM_AMOUNT, key=102)
|
|
214
|
+
|
|
215
|
+
```java
|
|
216
|
+
// DTO
|
|
217
|
+
public class PriceLimitSumAmountDTO {
|
|
218
|
+
private Integer limitType; // 限制周期
|
|
219
|
+
private BigDecimal limitAmount; // 累计上限
|
|
220
|
+
private List<Integer> mealtimeTypes;
|
|
221
|
+
}
|
|
222
|
+
// Handler 路径
|
|
223
|
+
rule.price.handler.limitsumamount.extension.impl.DefaultPriceLimitSumAmountHandlerImpl
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 菜品/商品类规则
|
|
229
|
+
|
|
230
|
+
### 15-16. 菜品打折 / 菜品打折限购(key=151, 152)
|
|
231
|
+
|
|
232
|
+
```java
|
|
233
|
+
// PriceDishDiscountDTO / PriceDishDiscountLimitDTO
|
|
234
|
+
// 按菜品或类别维度设置折扣,可限制折扣份数
|
|
235
|
+
rule.price.handler.dishdiscount / dishdiscountlimit
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 17. 套餐优惠(RULE_DISH_PACKAGE, key=153)
|
|
239
|
+
|
|
240
|
+
按菜品套餐组合计价。
|
|
241
|
+
|
|
242
|
+
### 18-19. 商品打折 / 商品打折限购(key=251, 252)
|
|
243
|
+
|
|
244
|
+
```java
|
|
245
|
+
// PriceGoodsDiscountDTO / PriceGoodsDiscountLimitDTO
|
|
246
|
+
rule.price.handler.goodsdiscount / goodsdiscountlimit
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 限制周期枚举 RulePriceLimitEnum
|
|
252
|
+
|
|
253
|
+
| 枚举 | key | 说明 |
|
|
254
|
+
|------|-----|------|
|
|
255
|
+
| LIMIT_DAY | 1 | 按日 |
|
|
256
|
+
| LIMIT_WEEK | 2 | 按周 |
|
|
257
|
+
| LIMIT_MONTH | 3 | 按月 |
|
|
258
|
+
| LIMIT_QUARTER | 4 | 按季 |
|
|
259
|
+
| LIMIT_HALF | 5 | 按半年 |
|
|
260
|
+
| LIMIT_YEAR | 6 | 按年 |
|
|
261
|
+
| LIMIT_MEALTIME | 7 | 按餐次 |
|
|
262
|
+
|
|
263
|
+
## 菜品维度枚举 RulePriceDishIdTypeEnum
|
|
264
|
+
|
|
265
|
+
| 枚举 | key | 说明 |
|
|
266
|
+
|------|-----|------|
|
|
267
|
+
| DISH_NAME | 1 | 按菜品/商品名称 |
|
|
268
|
+
| DISH_TYPE | 2 | 按菜品/商品类别 |
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 关键工具方法(MarketUtil)
|
|
273
|
+
|
|
274
|
+
```java
|
|
275
|
+
// 查询历史订单(用于限次/限额/累计计算)
|
|
276
|
+
MarketUtil.getOrders(order, limitType, mealtimeTypeList, sceneType);
|
|
277
|
+
|
|
278
|
+
// 查询当前交易中符合规则的订单(用于批量订单场景)
|
|
279
|
+
MarketUtil.getNowTrade(order, mealtimeTypeList, customDeviceList, limitType, orderResults);
|
|
280
|
+
|
|
281
|
+
// 格式化设备SN(用于规则匹配)
|
|
282
|
+
MarketUtil.formatDeviceSn(orderType, canteenId, stallId, deviceSn);
|
|
283
|
+
|
|
284
|
+
// 统计菜品数量
|
|
285
|
+
MarketUtil.countDish(details, dishIds, dishFlag);
|
|
286
|
+
```
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# 充值规则详解(RuleRechargeEnum)
|
|
2
|
+
|
|
3
|
+
## 规则执行顺序
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
限额规则 → 赠送规则 → 管理费规则
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
由 `RuleRechargeTypeDTO` 自动分类,`RuleRechargeResultDTO` 链式调用:
|
|
10
|
+
```java
|
|
11
|
+
recharge.calcLimitAmountRules(ruleRechargeType.getLimitAmountRules(), recordDTO, this::handle)
|
|
12
|
+
.calcDiscountRules(ruleRechargeType.getDiscountRules(), recordDTO, this::handle)
|
|
13
|
+
.calcOtherFeeRules(ruleRechargeType.getOtherFeeRules(), recordDTO, this::handle);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 分类判断方法
|
|
17
|
+
|
|
18
|
+
```java
|
|
19
|
+
RuleRechargeEnum.isDiscountRule(key); // 赠送类(满赠/按次赠送)
|
|
20
|
+
RuleRechargeEnum.isLimitAmountRule(key); // 限额类
|
|
21
|
+
RuleRechargeEnum.isOtherFeeRule(key); // 其他费用类(管理费)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 赠送类规则
|
|
27
|
+
|
|
28
|
+
### 1. 满赠(RULE_FULL_GIFT, key=1)
|
|
29
|
+
|
|
30
|
+
充值金额达到门槛后赠送。支持多档梯度。
|
|
31
|
+
|
|
32
|
+
```java
|
|
33
|
+
// DTO
|
|
34
|
+
public class RechargeGiftFullDTO {
|
|
35
|
+
private List<RechargeGiftFullItemDTO> items;
|
|
36
|
+
}
|
|
37
|
+
public class RechargeGiftFullItemDTO {
|
|
38
|
+
private BigDecimal fullAmount; // 满足门槛金额
|
|
39
|
+
private BigDecimal giftAmount; // 赠送金额
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Handler 路径
|
|
43
|
+
rule.recharge.handler.fullgift.extension.impl.DefaultRechargeFullGiftHandlerImpl
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. 按次数赠送(RULE_TIMES_GIFT, key=2)
|
|
47
|
+
|
|
48
|
+
按充值次数梯度赠送不同金额。
|
|
49
|
+
|
|
50
|
+
```java
|
|
51
|
+
// DTO
|
|
52
|
+
public class RechargeTimesGiftDTO {
|
|
53
|
+
private List<RechargeTimesGiftItemDTO> items;
|
|
54
|
+
}
|
|
55
|
+
public class RechargeTimesGiftItemDTO {
|
|
56
|
+
private Integer times; // 第 N 次充值
|
|
57
|
+
private BigDecimal giftAmount; // 赠送金额
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Handler 路径
|
|
61
|
+
rule.recharge.handler.timesgift.extension.impl.DefaultRechargeTimesGiftHandlerImpl
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 限额类规则
|
|
67
|
+
|
|
68
|
+
### 3. 单笔上限金额(RULE_MAX_AMOUNT, key=51)
|
|
69
|
+
|
|
70
|
+
单次充值金额不得超过上限。
|
|
71
|
+
|
|
72
|
+
```java
|
|
73
|
+
// DTO
|
|
74
|
+
public class RechargeMaxAmountDTO {
|
|
75
|
+
private BigDecimal maxAmount; // 单笔上限
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Handler 路径
|
|
79
|
+
rule.recharge.handler.maxamount.extension.impl.DefaultRechargeMaxAmountHandlerImpl
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 4. 累计上限金额(RULE_SUM_AMOUNT, key=52)
|
|
83
|
+
|
|
84
|
+
一定周期内累计充值不得超过上限。
|
|
85
|
+
|
|
86
|
+
```java
|
|
87
|
+
// DTO
|
|
88
|
+
public class RechargeSumAmountDTO {
|
|
89
|
+
private Integer limitType; // 限制周期(同 RulePriceLimitEnum)
|
|
90
|
+
private BigDecimal limitAmount; // 累计上限
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Handler 路径
|
|
94
|
+
rule.recharge.handler.sumamount.extension.impl.DefaultRechargeSumAmountHandlerImpl
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 费用类规则
|
|
100
|
+
|
|
101
|
+
### 5. 管理费(RULE_MANAGE_COST, key=101)
|
|
102
|
+
|
|
103
|
+
充值时按比例或固定金额收取管理费。
|
|
104
|
+
|
|
105
|
+
```java
|
|
106
|
+
// DTO
|
|
107
|
+
public class RechargeCostDTO {
|
|
108
|
+
private List<RechargeCostItemDTO> items;
|
|
109
|
+
}
|
|
110
|
+
public class RechargeCostItemDTO {
|
|
111
|
+
private Integer costType; // 1=固定金额, 2=比例
|
|
112
|
+
private BigDecimal costValue; // 金额或比例值
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Handler 路径
|
|
116
|
+
rule.recharge.handler.managecost.extension.impl.DefaultRechargeCostHandlerImpl
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 充值规则 Handler 接口
|
|
122
|
+
|
|
123
|
+
```java
|
|
124
|
+
public interface RuleRechargeHandler {
|
|
125
|
+
void handle(RuleRechargeResultDTO resultDTO, MarketRuleVO ruleInfo);
|
|
126
|
+
Integer getRuleType();
|
|
127
|
+
default void checkRuleInfo(String ruleInfo) {}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### RuleRechargeResultDTO 关键字段
|
|
132
|
+
|
|
133
|
+
| 字段 | 说明 |
|
|
134
|
+
|------|------|
|
|
135
|
+
| rechargeAmount | 充值金额 |
|
|
136
|
+
| actualAmount | 实际到账金额(含赠送) |
|
|
137
|
+
| giftAmount | 赠送金额 |
|
|
138
|
+
| costAmount | 管理费金额 |
|
|
139
|
+
| walletDetails | 钱包明细 |
|
|
140
|
+
| ruleRecord | 规则计算记录 |
|
|
141
|
+
|
|
142
|
+
### RuleRechargeComputeDTO 关键字段
|
|
143
|
+
|
|
144
|
+
| 字段 | 说明 |
|
|
145
|
+
|------|------|
|
|
146
|
+
| custId | 人员ID |
|
|
147
|
+
| rechargeAmount | 充值金额 |
|
|
148
|
+
| walletType | 钱包类型 |
|
|
149
|
+
| tryFlag | 试算标志(1=试算,不记录) |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 充值规则定制示例
|
|
154
|
+
|
|
155
|
+
### 为满赠规则添加钱包类型过滤
|
|
156
|
+
|
|
157
|
+
```java
|
|
158
|
+
// 1. 扩展 DTO(核心包名下覆盖)
|
|
159
|
+
@Data
|
|
160
|
+
public class RechargeGiftFullDTO {
|
|
161
|
+
private List<RechargeGiftFullItemDTO> items;
|
|
162
|
+
// 扩展字段
|
|
163
|
+
@ApiModelProperty("适用钱包类型(null=所有钱包)")
|
|
164
|
+
private List<Integer> walletTypes;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 2. 定制实现(定制项目包名)
|
|
168
|
+
@Slf4j
|
|
169
|
+
@Service
|
|
170
|
+
@Primary
|
|
171
|
+
public class CustomRechargeFullGiftHandlerImpl
|
|
172
|
+
implements RechargeFullGiftHandlerExtension {
|
|
173
|
+
|
|
174
|
+
@Override
|
|
175
|
+
public void handle(RuleRechargeResultDTO resultDTO, MarketRuleVO rule) {
|
|
176
|
+
RechargeGiftFullDTO ruleInfo = JSON.parseObject(
|
|
177
|
+
rule.getRuleInfo(), RechargeGiftFullDTO.class);
|
|
178
|
+
|
|
179
|
+
// 向后兼容:null 时不过滤
|
|
180
|
+
if (CollUtil.isNotEmpty(ruleInfo.getWalletTypes())
|
|
181
|
+
&& !ruleInfo.getWalletTypes().contains(resultDTO.getWalletType())) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 满赠逻辑...
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|