ai-engineering-init 1.1.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/agents/code-reviewer.md +139 -0
- package/.claude/agents/project-manager.md +159 -0
- package/.claude/audio/completed.wav +0 -0
- package/.claude/commands/add-todo.md +255 -0
- package/.claude/commands/check.md +210 -0
- package/.claude/commands/crud.md +454 -0
- package/.claude/commands/dev.md +503 -0
- package/.claude/commands/init-docs.md +681 -0
- package/.claude/commands/next.md +251 -0
- package/.claude/commands/progress.md +242 -0
- package/.claude/commands/start.md +199 -0
- package/.claude/commands/sync.md +307 -0
- package/.claude/commands/update-status.md +428 -0
- package/.claude/docs/Mixin/344/275/277/347/224/250/346/214/207/345/215/227.md +299 -0
- package/.claude/docs/README.md +167 -0
- package/.claude/docs//345/211/215/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +599 -0
- package/.claude/docs//345/220/216/347/253/257/345/274/200/345/217/221/346/214/207/345/215/227.md +726 -0
- package/.claude/docs//345/267/245/344/275/234/346/265/201/345/274/200/345/217/221/346/214/207/345/215/227.md +714 -0
- package/.claude/docs//345/267/245/345/205/267/347/261/273/344/275/277/347/224/250/346/214/207/345/215/227.md +463 -0
- package/.claude/docs//346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/350/247/204/350/214/203.md +390 -0
- package/.claude/docs//346/226/260/345/212/237/350/203/275/345/274/200/345/217/221/346/265/201/347/250/213/350/247/204/350/214/203.md +688 -0
- package/.claude/docs//346/226/260/351/241/271/347/233/256/345/274/200/345/217/221/346/265/201/347/250/213.md +365 -0
- package/.claude/docs//346/241/206/346/236/266/350/257/264/346/230/216.md +393 -0
- package/.claude/docs//350/267/257/347/224/261/351/205/215/347/275/256/346/214/207/345/215/227.md +246 -0
- package/.claude/framework-config.json +73 -0
- package/.claude/hooks/pre-tool-use.js +117 -0
- package/.claude/hooks/skill-forced-eval.js +167 -0
- package/.claude/hooks/stop.js +58 -0
- package/.claude/settings.json +41 -0
- package/.claude/skills/add-skill/SKILL.md +352 -0
- package/.claude/skills/api-development/SKILL.md +560 -0
- package/.claude/skills/architecture-design/SKILL.md +756 -0
- package/.claude/skills/backend-annotations/SKILL.md +674 -0
- package/.claude/skills/banana-image/CHANGELOG.md +37 -0
- package/.claude/skills/banana-image/README.md +146 -0
- package/.claude/skills/banana-image/SKILL.md +164 -0
- package/.claude/skills/banana-image/assets/logo.png +0 -0
- package/.claude/skills/banana-image/references/advanced-usage.md +189 -0
- package/.claude/skills/banana-image/scripts/apply_template.py +125 -0
- package/.claude/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.claude/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.claude/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.claude/skills/banana-image/scripts/package.json +18 -0
- package/.claude/skills/banana-image/scripts/requirements.txt +10 -0
- package/.claude/skills/banana-image/templates/poster.json +22 -0
- package/.claude/skills/banana-image/templates/product.json +17 -0
- package/.claude/skills/banana-image/templates/social.json +22 -0
- package/.claude/skills/banana-image/templates/thumbnail.json +17 -0
- package/.claude/skills/brainstorm/SKILL.md +648 -0
- package/.claude/skills/bug-detective/SKILL.md +1206 -0
- package/.claude/skills/code-patterns/SKILL.md +590 -0
- package/.claude/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.claude/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.claude/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.claude/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.claude/skills/crud-development/SKILL.md +649 -0
- package/.claude/skills/data-permission/SKILL.md +599 -0
- package/.claude/skills/database-ops/SKILL.md +407 -0
- package/.claude/skills/error-handler/SKILL.md +371 -0
- package/.claude/skills/file-oss-management/SKILL.md +863 -0
- package/.claude/skills/git-workflow/SKILL.md +375 -0
- package/.claude/skills/json-serialization/SKILL.md +357 -0
- package/.claude/skills/leniu-api-development/SKILL.md +803 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +598 -0
- package/.claude/skills/leniu-backend-annotations/SKILL.md +664 -0
- package/.claude/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +256 -0
- package/.claude/skills/leniu-database-ops/SKILL.md +426 -0
- package/.claude/skills/leniu-error-handler/SKILL.md +462 -0
- package/.claude/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.claude/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.claude/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +751 -0
- package/.claude/skills/leniu-java-export/SKILL.md +560 -0
- package/.claude/skills/leniu-java-logging/SKILL.md +832 -0
- package/.claude/skills/leniu-java-mq/SKILL.md +338 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.claude/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.claude/skills/leniu-java-task/SKILL.md +367 -0
- package/.claude/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.claude/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.claude/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.claude/skills/leniu-mealtime/SKILL.md +215 -0
- package/.claude/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +520 -0
- package/.claude/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
- package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.claude/skills/openspec-continue-change/SKILL.md +118 -0
- package/.claude/skills/openspec-explore/SKILL.md +290 -0
- package/.claude/skills/openspec-ff-change/SKILL.md +101 -0
- package/.claude/skills/openspec-new-change/SKILL.md +74 -0
- package/.claude/skills/openspec-onboard/SKILL.md +529 -0
- package/.claude/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.claude/skills/openspec-verify-change/SKILL.md +168 -0
- package/.claude/skills/performance-doctor/SKILL.md +627 -0
- package/.claude/skills/project-navigator/SKILL.md +305 -0
- package/.claude/skills/redis-cache/SKILL.md +839 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +633 -0
- package/.claude/skills/security-guard/SKILL.md +748 -0
- package/.claude/skills/sms-mail/SKILL.md +766 -0
- package/.claude/skills/social-login/SKILL.md +668 -0
- package/.claude/skills/store-pc/SKILL.md +366 -0
- package/.claude/skills/task-tracker/SKILL.md +307 -0
- package/.claude/skills/tech-decision/SKILL.md +393 -0
- package/.claude/skills/tenant-management/SKILL.md +603 -0
- package/.claude/skills/test-development/SKILL.md +755 -0
- package/.claude/skills/ui-pc/SKILL.md +438 -0
- package/.claude/skills/utils-toolkit/SKILL.md +615 -0
- package/.claude/skills/websocket-sse/SKILL.md +716 -0
- package/.claude/skills/workflow-engine/SKILL.md +676 -0
- package/.claude/templates//345/276/205/345/212/236/346/270/205/345/215/225/346/250/241/346/235/277.md +56 -0
- package/.claude/templates//351/234/200/346/261/202/346/226/207/346/241/243/346/250/241/346/235/277.md +85 -0
- package/.claude/templates//351/241/271/347/233/256/347/212/266/346/200/201/346/250/241/346/235/277.md +43 -0
- package/.codex/skills/add-skill/SKILL.md +352 -0
- package/.codex/skills/add-todo/SKILL.md +269 -0
- package/.codex/skills/api-development/SKILL.md +693 -0
- package/.codex/skills/architecture-design/SKILL.md +628 -0
- package/.codex/skills/backend-annotations/SKILL.md +664 -0
- package/.codex/skills/banana-image/CHANGELOG.md +37 -0
- package/.codex/skills/banana-image/README.md +146 -0
- package/.codex/skills/banana-image/SKILL.md +164 -0
- package/.codex/skills/banana-image/assets/logo.png +0 -0
- package/.codex/skills/banana-image/references/advanced-usage.md +189 -0
- package/.codex/skills/banana-image/scripts/apply_template.py +125 -0
- package/.codex/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.codex/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.codex/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.codex/skills/banana-image/scripts/package.json +18 -0
- package/.codex/skills/banana-image/scripts/requirements.txt +10 -0
- package/.codex/skills/banana-image/templates/poster.json +22 -0
- package/.codex/skills/banana-image/templates/product.json +17 -0
- package/.codex/skills/banana-image/templates/social.json +22 -0
- package/.codex/skills/banana-image/templates/thumbnail.json +17 -0
- package/.codex/skills/brainstorm/SKILL.md +648 -0
- package/.codex/skills/bug-detective/SKILL.md +1206 -0
- package/.codex/skills/check/SKILL.md +367 -0
- package/.codex/skills/code-patterns/SKILL.md +442 -0
- package/.codex/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.codex/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.codex/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.codex/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.codex/skills/crud/SKILL.md +265 -0
- package/.codex/skills/crud-development/SKILL.md +637 -0
- package/.codex/skills/data-permission/SKILL.md +591 -0
- package/.codex/skills/database-ops/SKILL.md +553 -0
- package/.codex/skills/dev/SKILL.md +187 -0
- package/.codex/skills/error-handler/SKILL.md +361 -0
- package/.codex/skills/file-oss-management/SKILL.md +863 -0
- package/.codex/skills/git-workflow/SKILL.md +375 -0
- package/.codex/skills/init-docs/SKILL.md +194 -0
- package/.codex/skills/json-serialization/SKILL.md +357 -0
- package/.codex/skills/leniu-api-development/SKILL.md +803 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +594 -0
- package/.codex/skills/leniu-backend-annotations/SKILL.md +662 -0
- package/.codex/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +256 -0
- package/.codex/skills/leniu-database-ops/SKILL.md +426 -0
- package/.codex/skills/leniu-error-handler/SKILL.md +462 -0
- package/.codex/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +751 -0
- package/.codex/skills/leniu-java-export/SKILL.md +560 -0
- package/.codex/skills/leniu-java-logging/SKILL.md +832 -0
- package/.codex/skills/leniu-java-mq/SKILL.md +338 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.codex/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.codex/skills/leniu-java-task/SKILL.md +367 -0
- package/.codex/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.codex/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.codex/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.codex/skills/leniu-mealtime/SKILL.md +215 -0
- package/.codex/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +520 -0
- package/.codex/skills/leniu-utils-toolkit/SKILL.md +378 -0
- package/.codex/skills/next/SKILL.md +137 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +156 -0
- package/.codex/skills/openspec-archive-change/SKILL.md +114 -0
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.codex/skills/openspec-continue-change/SKILL.md +118 -0
- package/.codex/skills/openspec-explore/SKILL.md +290 -0
- package/.codex/skills/openspec-ff-change/SKILL.md +101 -0
- package/.codex/skills/openspec-new-change/SKILL.md +74 -0
- package/.codex/skills/openspec-onboard/SKILL.md +529 -0
- package/.codex/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.codex/skills/openspec-verify-change/SKILL.md +168 -0
- package/.codex/skills/performance-doctor/SKILL.md +627 -0
- package/.codex/skills/progress/SKILL.md +193 -0
- package/.codex/skills/project-navigator/SKILL.md +286 -0
- package/.codex/skills/redis-cache/SKILL.md +829 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +633 -0
- package/.codex/skills/security-guard/SKILL.md +739 -0
- package/.codex/skills/sms-mail/SKILL.md +766 -0
- package/.codex/skills/social-login/SKILL.md +668 -0
- package/.codex/skills/start/SKILL.md +154 -0
- package/.codex/skills/store-pc/SKILL.md +491 -0
- package/.codex/skills/sync/SKILL.md +149 -0
- package/.codex/skills/task-tracker/SKILL.md +307 -0
- package/.codex/skills/tech-decision/SKILL.md +393 -0
- package/.codex/skills/tenant-management/SKILL.md +603 -0
- package/.codex/skills/test-development/SKILL.md +755 -0
- package/.codex/skills/ui-pc/SKILL.md +475 -0
- package/.codex/skills/update-status/SKILL.md +159 -0
- package/.codex/skills/utils-toolkit/SKILL.md +593 -0
- package/.codex/skills/websocket-sse/SKILL.md +716 -0
- package/.codex/skills/workflow-engine/SKILL.md +676 -0
- package/.cursor/agents/code-reviewer.md +139 -0
- package/.cursor/agents/project-manager.md +159 -0
- package/.cursor/commands/opsx-apply.md +152 -0
- package/.cursor/commands/opsx-archive.md +157 -0
- package/.cursor/commands/opsx-bulk-archive.md +242 -0
- package/.cursor/commands/opsx-continue.md +114 -0
- package/.cursor/commands/opsx-explore.md +174 -0
- package/.cursor/commands/opsx-ff.md +94 -0
- package/.cursor/commands/opsx-new.md +69 -0
- package/.cursor/commands/opsx-onboard.md +525 -0
- package/.cursor/commands/opsx-sync.md +134 -0
- package/.cursor/commands/opsx-verify.md +164 -0
- package/.cursor/mcp.json +22 -0
- package/.cursor/skills/add-skill/SKILL.md +352 -0
- package/.cursor/skills/api-development/SKILL.md +560 -0
- package/.cursor/skills/architecture-design/SKILL.md +756 -0
- package/.cursor/skills/backend-annotations/SKILL.md +674 -0
- package/.cursor/skills/banana-image/CHANGELOG.md +37 -0
- package/.cursor/skills/banana-image/README.md +146 -0
- package/.cursor/skills/banana-image/SKILL.md +164 -0
- package/.cursor/skills/banana-image/assets/logo.png +0 -0
- package/.cursor/skills/banana-image/references/advanced-usage.md +189 -0
- package/.cursor/skills/banana-image/scripts/apply_template.py +125 -0
- package/.cursor/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/.cursor/skills/banana-image/scripts/batch_prep.py +82 -0
- package/.cursor/skills/banana-image/scripts/package-lock.json +1437 -0
- package/.cursor/skills/banana-image/scripts/package.json +18 -0
- package/.cursor/skills/banana-image/scripts/requirements.txt +10 -0
- package/.cursor/skills/banana-image/templates/poster.json +22 -0
- package/.cursor/skills/banana-image/templates/product.json +17 -0
- package/.cursor/skills/banana-image/templates/social.json +22 -0
- package/.cursor/skills/banana-image/templates/thumbnail.json +17 -0
- package/.cursor/skills/brainstorm/SKILL.md +648 -0
- package/.cursor/skills/bug-detective/SKILL.md +1206 -0
- package/.cursor/skills/code-patterns/SKILL.md +590 -0
- package/.cursor/skills/collaborating-with-codex/SKILL.md +174 -0
- package/.cursor/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/.cursor/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/.cursor/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/.cursor/skills/crud-development/SKILL.md +649 -0
- package/.cursor/skills/data-permission/SKILL.md +599 -0
- package/.cursor/skills/database-ops/SKILL.md +407 -0
- package/.cursor/skills/error-handler/SKILL.md +371 -0
- package/.cursor/skills/file-oss-management/SKILL.md +863 -0
- package/.cursor/skills/git-workflow/SKILL.md +375 -0
- package/.cursor/skills/json-serialization/SKILL.md +357 -0
- package/.cursor/skills/leniu-api-development/SKILL.md +803 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +598 -0
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +664 -0
- package/.cursor/skills/leniu-code-patterns/SKILL.md +365 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +1110 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +256 -0
- package/.cursor/skills/leniu-database-ops/SKILL.md +426 -0
- package/.cursor/skills/leniu-error-handler/SKILL.md +462 -0
- package/.cursor/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +751 -0
- package/.cursor/skills/leniu-java-export/SKILL.md +560 -0
- package/.cursor/skills/leniu-java-logging/SKILL.md +832 -0
- package/.cursor/skills/leniu-java-mq/SKILL.md +338 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +640 -0
- package/.cursor/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/.cursor/skills/leniu-java-task/SKILL.md +367 -0
- package/.cursor/skills/leniu-java-total-line/SKILL.md +195 -0
- package/.cursor/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/.cursor/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/.cursor/skills/leniu-mealtime/SKILL.md +215 -0
- package/.cursor/skills/leniu-redis-cache/SKILL.md +316 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +520 -0
- package/.cursor/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +156 -0
- package/.cursor/skills/openspec-archive-change/SKILL.md +114 -0
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.cursor/skills/openspec-continue-change/SKILL.md +118 -0
- package/.cursor/skills/openspec-explore/SKILL.md +290 -0
- package/.cursor/skills/openspec-ff-change/SKILL.md +101 -0
- package/.cursor/skills/openspec-new-change/SKILL.md +74 -0
- package/.cursor/skills/openspec-onboard/SKILL.md +529 -0
- package/.cursor/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.cursor/skills/openspec-verify-change/SKILL.md +168 -0
- package/.cursor/skills/performance-doctor/SKILL.md +627 -0
- package/.cursor/skills/project-navigator/SKILL.md +305 -0
- package/.cursor/skills/redis-cache/SKILL.md +839 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +633 -0
- package/.cursor/skills/security-guard/SKILL.md +748 -0
- package/.cursor/skills/sms-mail/SKILL.md +766 -0
- package/.cursor/skills/social-login/SKILL.md +668 -0
- package/.cursor/skills/store-pc/SKILL.md +366 -0
- package/.cursor/skills/task-tracker/SKILL.md +307 -0
- package/.cursor/skills/tech-decision/SKILL.md +393 -0
- package/.cursor/skills/tenant-management/SKILL.md +603 -0
- package/.cursor/skills/test-development/SKILL.md +755 -0
- package/.cursor/skills/ui-pc/SKILL.md +438 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +615 -0
- package/.cursor/skills/websocket-sse/SKILL.md +716 -0
- package/.cursor/skills/workflow-engine/SKILL.md +676 -0
- package/AGENTS.md +669 -0
- package/CLAUDE.md +205 -0
- package/README.md +205 -0
- package/bin/index.js +179 -0
- package/init.sh +178 -0
- package/package.json +27 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: leniu-java-total-line
|
|
3
|
+
description: |
|
|
4
|
+
leniu-tengyun-core / leniu-yunshitang 项目合计行查询规范。当实现报表分页查询需要合计行功能时使用此skill。
|
|
5
|
+
|
|
6
|
+
触发场景:
|
|
7
|
+
- 实现报表分页查询合计行(Service层合计查询)
|
|
8
|
+
- 编写Mapper XML合计SQL(只返回数值字段)
|
|
9
|
+
- Controller层合计行数据组装
|
|
10
|
+
- 合计查询开关控制
|
|
11
|
+
|
|
12
|
+
适用项目:
|
|
13
|
+
- leniu-tengyun-core:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun-core
|
|
14
|
+
- leniu-yunshitang:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun/leniu-yunshitang
|
|
15
|
+
|
|
16
|
+
触发词:leniu-合计行、leniu-totalLine、leniu-报表合计、leniu-合计查询、leniu-SUM合计、leniu-ReportBaseTotalVO、net.xnzn、leniu-yunshitang
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# leniu-tengyun-core 合计行(Total Line)规范
|
|
20
|
+
|
|
21
|
+
## 项目特征
|
|
22
|
+
|
|
23
|
+
| 特征 | 说明 |
|
|
24
|
+
|------|------|
|
|
25
|
+
| **包名前缀** | `net.xnzn.core.*` |
|
|
26
|
+
| **JDK 版本** | 21 |
|
|
27
|
+
| **跨租户工具** | `Executors.readInSystem()` |
|
|
28
|
+
| **分页工具** | `PageMethod.startPage()` |
|
|
29
|
+
| **结果封装** | `ReportBaseTotalVO<T>` |
|
|
30
|
+
| **分页封装** | `PageVO.of()` |
|
|
31
|
+
|
|
32
|
+
## 核心原则
|
|
33
|
+
|
|
34
|
+
**合计行SQL只返回需要合计的数值字段**,不返回非数值字段(如日期、名称、ID等)。
|
|
35
|
+
|
|
36
|
+
## Service层实现
|
|
37
|
+
|
|
38
|
+
### 带合计行的分页查询
|
|
39
|
+
|
|
40
|
+
```java
|
|
41
|
+
import net.xnzn.framework.data.executor.Executors;
|
|
42
|
+
import net.xnzn.core.common.page.PageMethod;
|
|
43
|
+
import net.xnzn.core.common.page.PageVO;
|
|
44
|
+
import net.xnzn.core.common.vo.ReportBaseTotalVO;
|
|
45
|
+
import cn.hutool.core.collection.CollUtil;
|
|
46
|
+
|
|
47
|
+
public ReportBaseTotalVO<XxxVO> pageWithTotal(XxxPageParam param) {
|
|
48
|
+
return Executors.readInSystem(() -> {
|
|
49
|
+
ReportBaseTotalVO<XxxVO> result = new ReportBaseTotalVO<>();
|
|
50
|
+
|
|
51
|
+
// 1. 导出时不查询合计行(避免不必要的性能开销)
|
|
52
|
+
if (CollUtil.isEmpty(param.getExportCols())) {
|
|
53
|
+
XxxVO totalLine = mapper.getSummaryTotal(param);
|
|
54
|
+
result.setTotalLine(totalLine);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 2. 开启分页
|
|
58
|
+
PageMethod.startPage(param.getPage());
|
|
59
|
+
|
|
60
|
+
// 3. 查询数据
|
|
61
|
+
List<XxxVO> list = mapper.getSummaryList(param);
|
|
62
|
+
|
|
63
|
+
// 4. 封装分页结果
|
|
64
|
+
result.setResultPage(PageVO.of(list));
|
|
65
|
+
return result;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 单独的合计行查询方法
|
|
71
|
+
|
|
72
|
+
```java
|
|
73
|
+
public XxxVO getSummaryTotal(XxxPageParam param) {
|
|
74
|
+
return Executors.readInSystem(() -> mapper.getSummaryTotal(param));
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Mapper XML规范
|
|
79
|
+
|
|
80
|
+
### 错误示例:返回非数值字段
|
|
81
|
+
|
|
82
|
+
```xml
|
|
83
|
+
<!-- ❌ 不要这样做 -->
|
|
84
|
+
<select id="getSummaryTotal" resultType="XxxVO">
|
|
85
|
+
SELECT
|
|
86
|
+
'合计' AS dateMonth, <!-- ❌ 不要返回字符串 -->
|
|
87
|
+
NULL AS schoolId, <!-- ❌ 不要返回ID -->
|
|
88
|
+
NULL AS schoolName, <!-- ❌ 不要返回名称 -->
|
|
89
|
+
SUM(staffCount) AS staffCount,
|
|
90
|
+
SUM(amount) AS amount
|
|
91
|
+
FROM xxx_table
|
|
92
|
+
</select>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 正确示例:只返回数值字段
|
|
96
|
+
|
|
97
|
+
```xml
|
|
98
|
+
<!-- ✅ 正确做法 -->
|
|
99
|
+
<select id="getSummaryTotal" resultType="XxxVO">
|
|
100
|
+
SELECT
|
|
101
|
+
SUM(staff_count) AS staffCount,
|
|
102
|
+
SUM(basic_salary) AS basicSalary,
|
|
103
|
+
SUM(overtime_salary) AS overtimeSalary,
|
|
104
|
+
SUM(personal_actual_amount) AS personalActualAmount,
|
|
105
|
+
CASE
|
|
106
|
+
WHEN SUM(staff_count) = 0 THEN 0
|
|
107
|
+
ELSE SUM(avg_salary) / COUNT(DISTINCT tenant_id)
|
|
108
|
+
END AS avgSalary
|
|
109
|
+
FROM xxx_table
|
|
110
|
+
<where>
|
|
111
|
+
del_flag = 2
|
|
112
|
+
<if test="startDate != null">
|
|
113
|
+
AND crtime >= #{startDate}
|
|
114
|
+
</if>
|
|
115
|
+
<if test="endDate != null">
|
|
116
|
+
AND crtime <= #{endDate}
|
|
117
|
+
</if>
|
|
118
|
+
</where>
|
|
119
|
+
</select>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 常见合计字段类型
|
|
123
|
+
|
|
124
|
+
| 字段类型 | 示例 | 合计方式 |
|
|
125
|
+
|---------|------|---------|
|
|
126
|
+
| 数量 | `staff_count`, `order_count` | `SUM()` |
|
|
127
|
+
| 金额 | `amount`, `salary` | `SUM()` |
|
|
128
|
+
| 百分比 | `discount_rate` | `AVG()` 或 `SUM() / COUNT()` |
|
|
129
|
+
| 计数 | `COUNT(DISTINCT id)` | 直接使用 |
|
|
130
|
+
|
|
131
|
+
## 特殊处理:平均值
|
|
132
|
+
|
|
133
|
+
```xml
|
|
134
|
+
<!-- 简单平均值 -->
|
|
135
|
+
SELECT AVG(amount) AS avgAmount
|
|
136
|
+
|
|
137
|
+
<!-- 加权平均值 -->
|
|
138
|
+
SELECT
|
|
139
|
+
CASE
|
|
140
|
+
WHEN SUM(count) = 0 THEN 0
|
|
141
|
+
ELSE SUM(amount * count) / SUM(count)
|
|
142
|
+
END AS weightedAvgAmount
|
|
143
|
+
|
|
144
|
+
<!-- 按维度平均 -->
|
|
145
|
+
SELECT
|
|
146
|
+
CASE
|
|
147
|
+
WHEN COUNT(DISTINCT tenant_id) = 0 THEN 0
|
|
148
|
+
ELSE SUM(total_amount) / COUNT(DISTINCT tenant_id)
|
|
149
|
+
END AS avgByTenant
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Controller层实现
|
|
153
|
+
|
|
154
|
+
```java
|
|
155
|
+
@PostMapping("/page")
|
|
156
|
+
@ApiOperation("分页查询(带合计)")
|
|
157
|
+
@RequiresAuthentication
|
|
158
|
+
public ReportBaseTotalVO<XxxVO> page(@RequestBody LeRequest<XxxParam> request) {
|
|
159
|
+
XxxParam param = request.getContent();
|
|
160
|
+
return xxxService.pageWithTotal(param);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@GetMapping("/total")
|
|
164
|
+
@ApiOperation("单独查询合计行")
|
|
165
|
+
@RequiresAuthentication
|
|
166
|
+
public XxxVO getTotal(XxxParam param) {
|
|
167
|
+
return xxxService.getSummaryTotal(param);
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 导出时合计行处理
|
|
172
|
+
|
|
173
|
+
```java
|
|
174
|
+
public void exportExcel(XxxParam param, HttpServletResponse response) {
|
|
175
|
+
// 导出时需要查询合计行
|
|
176
|
+
XxxVO totalLine = mapper.getSummaryTotal(param);
|
|
177
|
+
|
|
178
|
+
// 分页查询所有数据(不分页)
|
|
179
|
+
param.getPage().setSize(Integer.MAX_VALUE);
|
|
180
|
+
List<XxxVO> list = mapper.getSummaryList(param);
|
|
181
|
+
|
|
182
|
+
// 将合计行添加到列表末尾
|
|
183
|
+
list.add(totalLine);
|
|
184
|
+
|
|
185
|
+
// 导出
|
|
186
|
+
exportService.export(list, response);
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 注意事项
|
|
191
|
+
|
|
192
|
+
- 合计SQL只返回数值字段,不返回字符串、ID、名称等
|
|
193
|
+
- 使用 `Executors.readInSystem()` 跨租户查询
|
|
194
|
+
- 导出时通过 `exportCols` 判断是否需要合计行
|
|
195
|
+
- 金额字段类型与 Entity 保持一致:订单模块用 `BigDecimal`,钱包模块用 `Long`(详见 leniu-java-amount-handling)
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: leniu-marketing-price-rule-customizer
|
|
3
|
+
description: |
|
|
4
|
+
leniu-tengyun-core 项目营销计费(price)规则定制指南。当需要定制营销计费规则时使用,支持新增规则类型、重写规则逻辑、扩展 DTO 字段。
|
|
5
|
+
|
|
6
|
+
触发场景:
|
|
7
|
+
- 新增营销计费规则类型(折扣、满减、限额、补贴等)
|
|
8
|
+
- 重写现有计费规则逻辑(@Primary 模式)
|
|
9
|
+
- 扩展规则 DTO 字段(向后兼容)
|
|
10
|
+
- 定制规则计算行为(handle 方法实现)
|
|
11
|
+
- 注册规则枚举(RulePriceEnum)
|
|
12
|
+
|
|
13
|
+
适用项目:
|
|
14
|
+
- leniu-tengyun-core:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun-core
|
|
15
|
+
- leniu-yunshitang:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun/leniu-yunshitang
|
|
16
|
+
|
|
17
|
+
触发词:营销计费、price规则、计价规则、RulePriceHandler、RulePriceEnum、折扣规则、满减规则、限额规则、补贴规则、营销规则定制、leniu营销、leniu-yunshitang、net.xnzn
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# leniu-tengyun-core 营销计费规则定制
|
|
21
|
+
|
|
22
|
+
## 概述
|
|
23
|
+
|
|
24
|
+
leniu-tengyun-core 项目的营销计费(price)规则功能采用扩展点设计,支持灵活的规则定制。
|
|
25
|
+
|
|
26
|
+
营销计费规则是营销系统的核心组件,负责计算订单的优惠金额、限制消费行为、提供补贴等功能。
|
|
27
|
+
|
|
28
|
+
## 何时使用此 Skill
|
|
29
|
+
|
|
30
|
+
- 需要新增一个计价规则类型
|
|
31
|
+
- 需要修改现有规则的计算逻辑
|
|
32
|
+
- 需要为规则添加新的配置字段
|
|
33
|
+
- 需要针对特定项目定制规则行为
|
|
34
|
+
- 参考现有规则实现新的定制需求
|
|
35
|
+
|
|
36
|
+
## 规则定制工作流
|
|
37
|
+
|
|
38
|
+
### 步骤1:确定定制模式
|
|
39
|
+
|
|
40
|
+
根据需求选择合适的定制模式:
|
|
41
|
+
|
|
42
|
+
**模式A:新增规则**
|
|
43
|
+
- 适用场景:创建全新的规则类型
|
|
44
|
+
- 需要创建:DTO、扩展接口、默认实现
|
|
45
|
+
|
|
46
|
+
**模式B:重写规则(@Primary)**
|
|
47
|
+
- 适用场景:完全替换现有规则行为
|
|
48
|
+
- 需要创建:定制实现类(使用@Primary注解)
|
|
49
|
+
- 可选:扩展DTO字段
|
|
50
|
+
|
|
51
|
+
**模式C:重写规则(Ordered)**
|
|
52
|
+
- 适用场景:多个实现共存
|
|
53
|
+
- 需要创建:定制实现类(实现Ordered接口)
|
|
54
|
+
|
|
55
|
+
### 步骤2:理解规则结构
|
|
56
|
+
|
|
57
|
+
了解:
|
|
58
|
+
- 规则接口层次(RulePriceHandler → Extension → Implementation)
|
|
59
|
+
- 规则DTO结构
|
|
60
|
+
- 规则计算入参(RulePriceResultOrderDTO、MarketRuleVO、orderResults)
|
|
61
|
+
- 规则计算流程
|
|
62
|
+
- 常用工具类(MarketUtil、MarketRuleRangeService)
|
|
63
|
+
|
|
64
|
+
### 步骤3:参考实际案例
|
|
65
|
+
|
|
66
|
+
查看实际案例,了解如何实现具体的定制需求:
|
|
67
|
+
- **案例1**:支持自定义场景类型选择(@Primary + DTO扩展)
|
|
68
|
+
- **案例2**:移除订单类型过滤(直接修改)
|
|
69
|
+
|
|
70
|
+
### 步骤4:实现规则定制
|
|
71
|
+
|
|
72
|
+
#### 新增规则的实现步骤
|
|
73
|
+
|
|
74
|
+
1. **创建规则DTO**
|
|
75
|
+
- 位置:`net.xnzn.core.marketing.v2.rule.price.handler.[ruletype].dto`
|
|
76
|
+
- 包含规则配置字段
|
|
77
|
+
- 实现 `toString()` 方法返回可读描述
|
|
78
|
+
|
|
79
|
+
2. **创建扩展接口**
|
|
80
|
+
- 位置:`net.xnzn.core.marketing.v2.rule.price.handler.[ruletype].extension`
|
|
81
|
+
- 继承 `RulePriceHandler`
|
|
82
|
+
- 实现 `getRuleType()` 和 `checkRuleInfo()` 方法
|
|
83
|
+
|
|
84
|
+
3. **创建默认实现**
|
|
85
|
+
- 位置:`net.xnzn.core.marketing.v2.rule.price.handler.[ruletype].extension.impl`
|
|
86
|
+
- 实现扩展接口
|
|
87
|
+
- 添加 `@Service` 注解
|
|
88
|
+
- 实现 `handle()` 方法
|
|
89
|
+
|
|
90
|
+
4. **注册规则枚举**
|
|
91
|
+
- 在 `RulePriceEnum` 中添加新的规则类型
|
|
92
|
+
|
|
93
|
+
#### 重写规则的实现步骤(@Primary模式)
|
|
94
|
+
|
|
95
|
+
1. **(可选)扩展DTO字段**
|
|
96
|
+
- 在定制项目中覆盖核心DTO类
|
|
97
|
+
- 添加新字段并保持向后兼容
|
|
98
|
+
|
|
99
|
+
2. **创建定制实现**
|
|
100
|
+
- 位置:定制项目包(如 `net.xnzn.yunshitang.marketing.handler`)
|
|
101
|
+
- 继承默认实现类(可选,用于复用逻辑)
|
|
102
|
+
- 实现扩展接口
|
|
103
|
+
- 添加 `@Service` 和 `@Primary` 注解
|
|
104
|
+
- 重写 `handle()` 方法
|
|
105
|
+
|
|
106
|
+
3. **实现定制逻辑**
|
|
107
|
+
- 解析规则配置(包含新字段)
|
|
108
|
+
- 实现自定义计算逻辑
|
|
109
|
+
- 更新订单优惠金额或抛出限制异常
|
|
110
|
+
|
|
111
|
+
### 步骤5:测试规则
|
|
112
|
+
|
|
113
|
+
1. 测试向后兼容性(新字段为null的场景)
|
|
114
|
+
2. 测试新功能(新字段有值的场景)
|
|
115
|
+
3. 测试边界条件
|
|
116
|
+
4. 测试与其他规则的组合使用
|
|
117
|
+
|
|
118
|
+
## 代码模板
|
|
119
|
+
|
|
120
|
+
### 新增规则模板
|
|
121
|
+
|
|
122
|
+
```java
|
|
123
|
+
// 1. DTO
|
|
124
|
+
@Data
|
|
125
|
+
@ApiModel("计价规则详情-[规则名称]")
|
|
126
|
+
public class [RuleType]DTO {
|
|
127
|
+
@ApiModelProperty("[字段说明]")
|
|
128
|
+
private [Type] fieldName;
|
|
129
|
+
|
|
130
|
+
@Override
|
|
131
|
+
public String toString() {
|
|
132
|
+
return "字段:" + fieldName;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 2. 扩展接口
|
|
137
|
+
public interface [RuleType]HandlerExtension extends RulePriceHandler {
|
|
138
|
+
@Override
|
|
139
|
+
default Integer getRuleType() {
|
|
140
|
+
return RulePriceEnum.[RULE_TYPE_ENUM].getKey();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@Override
|
|
144
|
+
default String checkRuleInfo(String ruleInfo) {
|
|
145
|
+
[RuleType]DTO rule = JSON.parseObject(ruleInfo, [RuleType]DTO.class);
|
|
146
|
+
return rule.toString();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 3. 默认实现
|
|
151
|
+
@Slf4j
|
|
152
|
+
@Service
|
|
153
|
+
public class Default[RuleType]HandlerImpl implements [RuleType]HandlerExtension {
|
|
154
|
+
|
|
155
|
+
@Autowired
|
|
156
|
+
private MarketRuleRangeService rangeService;
|
|
157
|
+
|
|
158
|
+
@Override
|
|
159
|
+
public void handle(RulePriceResultOrderDTO order, MarketRuleVO rule,
|
|
160
|
+
List<RulePriceResultOrderDTO> orderResults) {
|
|
161
|
+
// 1. 解析规则配置
|
|
162
|
+
[RuleType]DTO ruleInfo = JSON.parseObject(rule.getRuleInfo(), [RuleType]DTO.class);
|
|
163
|
+
|
|
164
|
+
// 2. 查询规则适用范围
|
|
165
|
+
List<MarketRuleRange> rangeList = rangeService.listRuleRangeLatest(rule.getRuleId());
|
|
166
|
+
|
|
167
|
+
// 3. 实现规则计算逻辑
|
|
168
|
+
// ...
|
|
169
|
+
|
|
170
|
+
// 4. 更新订单优惠金额或抛出异常
|
|
171
|
+
order.setDiscountsAmount(order.getDiscountsAmount().add(discountAmount));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 重写规则模板(@Primary)
|
|
177
|
+
|
|
178
|
+
```java
|
|
179
|
+
@Slf4j
|
|
180
|
+
@Service
|
|
181
|
+
@Primary // 标记为主要实现
|
|
182
|
+
public class Custom[RuleType]HandlerImpl extends Default[RuleType]HandlerImpl
|
|
183
|
+
implements [RuleType]HandlerExtension {
|
|
184
|
+
|
|
185
|
+
@Autowired
|
|
186
|
+
private MarketRuleRangeService rangeService;
|
|
187
|
+
|
|
188
|
+
@Override
|
|
189
|
+
public void handle(RulePriceResultOrderDTO order, MarketRuleVO rule,
|
|
190
|
+
List<RulePriceResultOrderDTO> orderResults) {
|
|
191
|
+
// 解析规则配置(可能包含扩展字段)
|
|
192
|
+
[RuleType]DTO ruleInfo = JSON.parseObject(rule.getRuleInfo(), [RuleType]DTO.class);
|
|
193
|
+
|
|
194
|
+
// 实现定制逻辑
|
|
195
|
+
// 可以调用父类方法:super.handle(order, rule, orderResults);
|
|
196
|
+
// 或完全自定义实现
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 常见规则类型
|
|
202
|
+
|
|
203
|
+
### 优惠类规则
|
|
204
|
+
- 折扣规则:`PriceDiscountHandlerExtension`
|
|
205
|
+
- 菜品折扣:`PriceDishDiscountHandlerExtension`
|
|
206
|
+
- 商品折扣:`PriceGoodsDiscountHandlerExtension`
|
|
207
|
+
- 满减规则:`PriceReductionFixedHandlerExtension`
|
|
208
|
+
|
|
209
|
+
### 限制类规则
|
|
210
|
+
- 限额-单次金额:`PriceLimitMaxAmountHandlerExtension`
|
|
211
|
+
- 限额-累计次数:`PriceLimitMaxCountHandlerExtension`
|
|
212
|
+
- 限额-累计金额:`PriceLimitSumAmountHandlerExtension`
|
|
213
|
+
|
|
214
|
+
### 补贴类规则
|
|
215
|
+
- 固定补贴:`PriceSubsidyFixedHandlerExtension`
|
|
216
|
+
- 累计赠送:`PriceSumGiveHandlerExtension`
|
|
217
|
+
|
|
218
|
+
## 最佳实践
|
|
219
|
+
|
|
220
|
+
### 包名规范
|
|
221
|
+
- 覆盖核心类:使用核心工程的包名(`net.xnzn.core.marketing.v2.rule.price.handler.[ruletype]`)
|
|
222
|
+
- 定制实现:使用项目特定包名(如 `net.xnzn.yunshitang.marketing.handler`)
|
|
223
|
+
|
|
224
|
+
### 类名规范
|
|
225
|
+
- 扩展接口:`[RuleType]HandlerExtension`
|
|
226
|
+
- 默认实现:`Default[RuleType]HandlerImpl`
|
|
227
|
+
- 定制实现:`Custom[RuleType]HandlerImpl` 或描述性名称
|
|
228
|
+
|
|
229
|
+
### 注解使用
|
|
230
|
+
- 所有实现类必须添加 `@Service` 注解
|
|
231
|
+
- 重写规则使用 `@Primary` 注解(推荐)
|
|
232
|
+
- 日志记录使用 `@Slf4j` 注解
|
|
233
|
+
|
|
234
|
+
### 向后兼容
|
|
235
|
+
- 扩展DTO字段时,新字段应支持null值
|
|
236
|
+
- 新字段为null时应保持原有行为
|
|
237
|
+
- 在toString方法中包含所有字段
|
|
238
|
+
|
|
239
|
+
## 快速开始示例
|
|
240
|
+
|
|
241
|
+
假设需要为限额累计金额规则(`PriceLimitSumAmountHandlerExtension`)添加场景类型选择功能:
|
|
242
|
+
|
|
243
|
+
1. **扩展DTO**:在 `PriceLimitSumAmountDTO` 中添加 `sceneTypes` 字段
|
|
244
|
+
2. **创建定制实现**:创建 `CrossScenePriceLimitSumAmountHandlerImpl`,位于 `net.xnzn.yunshitang.marketing.handler`,使用 `@Primary` 注解
|
|
245
|
+
3. **实现逻辑**:在 `handle()` 方法中使用 `sceneTypes` 字段过滤订单
|
|
246
|
+
4. **向后兼容**:`sceneTypes` 为null时查询所有场景
|
|
247
|
+
|
|
248
|
+
```java
|
|
249
|
+
// 1. 扩展DTO(在核心工程包名下覆盖)
|
|
250
|
+
// 位置:net.xnzn.core.marketing.v2.rule.price.handler.limitsum.dto.PriceLimitSumAmountDTO
|
|
251
|
+
@Data
|
|
252
|
+
@ApiModel("限额-累计金额规则详情")
|
|
253
|
+
public class PriceLimitSumAmountDTO {
|
|
254
|
+
@ApiModelProperty("累计金额限额(分)")
|
|
255
|
+
private BigDecimal limitAmount;
|
|
256
|
+
|
|
257
|
+
// 扩展字段:场景类型列表,null时表示所有场景
|
|
258
|
+
@ApiModelProperty("适用场景类型(null=所有)")
|
|
259
|
+
private List<Integer> sceneTypes;
|
|
260
|
+
|
|
261
|
+
@Override
|
|
262
|
+
public String toString() {
|
|
263
|
+
return "limitAmount=" + limitAmount + ", sceneTypes=" + sceneTypes;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// 2. 定制实现(在yunshitang项目包下)
|
|
268
|
+
// 位置:net.xnzn.yunshitang.marketing.handler
|
|
269
|
+
@Slf4j
|
|
270
|
+
@Service
|
|
271
|
+
@Primary
|
|
272
|
+
public class CrossScenePriceLimitSumAmountHandlerImpl
|
|
273
|
+
implements PriceLimitSumAmountHandlerExtension {
|
|
274
|
+
|
|
275
|
+
@Autowired
|
|
276
|
+
private MarketRuleRangeService rangeService;
|
|
277
|
+
|
|
278
|
+
@Override
|
|
279
|
+
public void handle(RulePriceResultOrderDTO order, MarketRuleVO rule,
|
|
280
|
+
List<RulePriceResultOrderDTO> orderResults) {
|
|
281
|
+
PriceLimitSumAmountDTO ruleInfo = JSON.parseObject(
|
|
282
|
+
rule.getRuleInfo(), PriceLimitSumAmountDTO.class);
|
|
283
|
+
|
|
284
|
+
// 场景过滤(向后兼容:null时不过滤)
|
|
285
|
+
if (CollUtil.isNotEmpty(ruleInfo.getSceneTypes())
|
|
286
|
+
&& !ruleInfo.getSceneTypes().contains(order.getSceneType())) {
|
|
287
|
+
return; // 不在适用场景内,跳过
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// 原有累计金额限额逻辑...
|
|
291
|
+
BigDecimal sumAmount = calcSumAmount(order, orderResults);
|
|
292
|
+
if (sumAmount.compareTo(ruleInfo.getLimitAmount()) >= 0) {
|
|
293
|
+
throw new LeException("已超出累计消费限额");
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## 参考文档
|
|
300
|
+
|
|
301
|
+
详见:[leniu-tengyun-core 源码](/Users/xujiajun/Developer/gongsi_proj/core/leniu-tengyun-core)
|