ai-engineering-init 1.3.4 → 1.4.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 +2 -0
- package/.claude/settings.json +3 -3
- package/.claude/skills/add-skill/SKILL.md +79 -32
- package/.claude/skills/api-development/SKILL.md +83 -377
- package/.claude/skills/architecture-design/SKILL.md +138 -632
- package/.claude/skills/backend-annotations/SKILL.md +134 -506
- package/.claude/skills/banana-image/SKILL.md +10 -3
- package/.claude/skills/brainstorm/SKILL.md +103 -535
- package/.claude/skills/bug-detective/SKILL.md +147 -1097
- package/.claude/skills/bug-detective/references/error-patterns.md +242 -0
- package/.claude/skills/code-patterns/SKILL.md +116 -426
- package/.claude/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.claude/skills/crud-development/SKILL.md +64 -304
- package/.claude/skills/data-permission/SKILL.md +105 -412
- package/.claude/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.claude/skills/file-oss-management/SKILL.md +106 -714
- package/.claude/skills/file-oss-management/references/entities.md +105 -0
- package/.claude/skills/file-oss-management/references/service-impl.md +104 -0
- package/.claude/skills/leniu-api-development/SKILL.md +142 -626
- package/.claude/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.claude/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.claude/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.claude/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +232 -938
- package/.claude/skills/leniu-crud-development/references/templates.md +597 -0
- package/.claude/skills/leniu-customization-location/SKILL.md +410 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +70 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +76 -590
- package/.claude/skills/leniu-java-entity/references/templates.md +237 -0
- package/.claude/skills/leniu-java-export/SKILL.md +94 -379
- package/.claude/skills/leniu-java-logging/SKILL.md +106 -709
- package/.claude/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.claude/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.claude/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.claude/skills/leniu-report-customization/SKILL.md +111 -365
- package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.claude/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.claude/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.claude/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +133 -347
- package/.claude/skills/mysql-debug/SKILL.md +364 -0
- package/.claude/skills/openspec-apply-change/SKILL.md +10 -1
- package/.claude/skills/openspec-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-continue-change/SKILL.md +9 -1
- package/.claude/skills/openspec-explore/SKILL.md +10 -1
- package/.claude/skills/openspec-ff-change/SKILL.md +9 -1
- package/.claude/skills/openspec-new-change/SKILL.md +9 -1
- package/.claude/skills/openspec-onboard/SKILL.md +15 -130
- package/.claude/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.claude/skills/openspec-verify-change/SKILL.md +9 -1
- package/.claude/skills/performance-doctor/SKILL.md +110 -434
- package/.claude/skills/redis-cache/SKILL.md +89 -595
- package/.claude/skills/redis-cache/references/listeners.md +23 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +88 -407
- package/.claude/skills/security-guard/SKILL.md +137 -532
- package/.claude/skills/security-guard/references/encrypt-config.md +103 -0
- package/.claude/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.claude/skills/sms-mail/SKILL.md +116 -574
- package/.claude/skills/sms-mail/references/mail-config.md +88 -0
- package/.claude/skills/sms-mail/references/sms-config.md +74 -0
- package/.claude/skills/social-login/SKILL.md +112 -514
- package/.claude/skills/social-login/references/provider-configs.md +118 -0
- package/.claude/skills/tenant-management/SKILL.md +129 -444
- package/.claude/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.claude/skills/test-development/SKILL.md +86 -540
- package/.claude/skills/test-development/references/parameterized-examples.md +119 -0
- package/.claude/skills/utils-toolkit/SKILL.md +52 -305
- package/.claude/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.claude/skills/websocket-sse/SKILL.md +105 -550
- package/.claude/skills/workflow-engine/SKILL.md +147 -502
- package/.codex/skills/add-skill/SKILL.md +79 -32
- package/.codex/skills/api-development/SKILL.md +172 -599
- package/.codex/skills/architecture-design/SKILL.md +138 -504
- package/.codex/skills/backend-annotations/SKILL.md +134 -496
- package/.codex/skills/banana-image/SKILL.md +10 -3
- package/.codex/skills/brainstorm/SKILL.md +103 -535
- package/.codex/skills/bug-detective/SKILL.md +147 -1097
- package/.codex/skills/bug-detective/references/error-patterns.md +242 -0
- package/.codex/skills/code-patterns/SKILL.md +120 -282
- package/.codex/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.codex/skills/crud-development/SKILL.md +64 -292
- package/.codex/skills/data-permission/SKILL.md +108 -407
- package/.codex/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.codex/skills/database-ops/SKILL.md +8 -154
- package/.codex/skills/error-handler/SKILL.md +10 -0
- package/.codex/skills/file-oss-management/SKILL.md +106 -714
- package/.codex/skills/file-oss-management/references/entities.md +105 -0
- package/.codex/skills/file-oss-management/references/service-impl.md +104 -0
- package/.codex/skills/git-workflow/SKILL.md +27 -5
- package/.codex/skills/leniu-api-development/SKILL.md +142 -626
- package/.codex/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.codex/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.codex/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.codex/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +232 -938
- package/.codex/skills/leniu-crud-development/references/templates.md +597 -0
- package/.codex/skills/leniu-customization-location/SKILL.md +410 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +70 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +76 -590
- package/.codex/skills/leniu-java-entity/references/templates.md +237 -0
- package/.codex/skills/leniu-java-export/SKILL.md +94 -379
- package/.codex/skills/leniu-java-logging/SKILL.md +106 -709
- package/.codex/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.codex/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.codex/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.codex/skills/leniu-report-customization/SKILL.md +111 -365
- package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.codex/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.codex/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.codex/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +133 -347
- package/.codex/skills/mysql-debug/SKILL.md +364 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +10 -1
- package/.codex/skills/openspec-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-continue-change/SKILL.md +9 -1
- package/.codex/skills/openspec-explore/SKILL.md +10 -1
- package/.codex/skills/openspec-ff-change/SKILL.md +9 -1
- package/.codex/skills/openspec-new-change/SKILL.md +9 -1
- package/.codex/skills/openspec-onboard/SKILL.md +15 -130
- package/.codex/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.codex/skills/openspec-verify-change/SKILL.md +9 -1
- package/.codex/skills/performance-doctor/SKILL.md +110 -434
- package/.codex/skills/project-navigator/SKILL.md +20 -1
- package/.codex/skills/redis-cache/SKILL.md +93 -589
- package/.codex/skills/redis-cache/references/listeners.md +23 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +88 -407
- package/.codex/skills/security-guard/SKILL.md +141 -527
- package/.codex/skills/security-guard/references/encrypt-config.md +103 -0
- package/.codex/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.codex/skills/sms-mail/SKILL.md +116 -574
- package/.codex/skills/sms-mail/references/mail-config.md +88 -0
- package/.codex/skills/sms-mail/references/sms-config.md +74 -0
- package/.codex/skills/social-login/SKILL.md +112 -514
- package/.codex/skills/social-login/references/provider-configs.md +118 -0
- package/.codex/skills/store-pc/SKILL.md +258 -383
- package/.codex/skills/tenant-management/SKILL.md +129 -444
- package/.codex/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.codex/skills/test-development/SKILL.md +86 -540
- package/.codex/skills/test-development/references/parameterized-examples.md +119 -0
- package/.codex/skills/ui-pc/SKILL.md +350 -387
- package/.codex/skills/utils-toolkit/SKILL.md +52 -283
- package/.codex/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.codex/skills/websocket-sse/SKILL.md +105 -550
- package/.codex/skills/workflow-engine/SKILL.md +147 -502
- package/.cursor/hooks.json +3 -3
- package/.cursor/skills/add-skill/SKILL.md +79 -32
- package/.cursor/skills/api-development/SKILL.md +83 -377
- package/.cursor/skills/architecture-design/SKILL.md +138 -632
- package/.cursor/skills/backend-annotations/SKILL.md +134 -506
- package/.cursor/skills/banana-image/SKILL.md +10 -3
- package/.cursor/skills/brainstorm/SKILL.md +103 -535
- package/.cursor/skills/bug-detective/SKILL.md +147 -1097
- package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
- package/.cursor/skills/code-patterns/SKILL.md +116 -426
- package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.cursor/skills/crud-development/SKILL.md +64 -304
- package/.cursor/skills/data-permission/SKILL.md +105 -412
- package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.cursor/skills/file-oss-management/SKILL.md +106 -714
- package/.cursor/skills/file-oss-management/references/entities.md +105 -0
- package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
- package/.cursor/skills/git-workflow/SKILL.md +27 -5
- package/.cursor/skills/leniu-api-development/SKILL.md +142 -626
- package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.cursor/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +232 -938
- package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
- package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +70 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +76 -590
- package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
- package/.cursor/skills/leniu-java-export/SKILL.md +94 -379
- package/.cursor/skills/leniu-java-logging/SKILL.md +106 -709
- package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.cursor/skills/leniu-report-customization/SKILL.md +111 -365
- package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.cursor/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +133 -347
- package/.cursor/skills/mysql-debug/SKILL.md +364 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +10 -1
- package/.cursor/skills/openspec-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-continue-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-explore/SKILL.md +10 -1
- package/.cursor/skills/openspec-ff-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-new-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-onboard/SKILL.md +15 -130
- package/.cursor/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.cursor/skills/openspec-verify-change/SKILL.md +9 -1
- package/.cursor/skills/performance-doctor/SKILL.md +110 -434
- package/.cursor/skills/redis-cache/SKILL.md +89 -595
- package/.cursor/skills/redis-cache/references/listeners.md +23 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +88 -407
- package/.cursor/skills/security-guard/SKILL.md +137 -532
- package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
- package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.cursor/skills/sms-mail/SKILL.md +116 -574
- package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
- package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
- package/.cursor/skills/social-login/SKILL.md +112 -514
- package/.cursor/skills/social-login/references/provider-configs.md +118 -0
- package/.cursor/skills/tenant-management/SKILL.md +129 -444
- package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.cursor/skills/test-development/SKILL.md +86 -540
- package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +52 -305
- package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.cursor/skills/websocket-sse/SKILL.md +105 -550
- package/.cursor/skills/workflow-engine/SKILL.md +147 -502
- package/package.json +1 -1
|
@@ -15,83 +15,48 @@ description: |
|
|
|
15
15
|
|
|
16
16
|
# leniu 标准版定制报表开发指南
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
> 详细字段说明见 `references/table-fields.md`,经营分析详情见 `references/analysis-module.md`
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## 版本识别(必读)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**本 skill 仅适用于标准版(core-report 独立模块)**。
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
| 判断方式 | 标准版(本指南) | v5.29 版本 |
|
|
25
|
+
|---------|--------------|-----------|
|
|
26
|
+
| 目录结构 | `core-report/` 独立模块 | `sys-canteen/` 内嵌 |
|
|
27
|
+
| 退款存储 | 独立 `report_refund` 表(**正数**) | 合并入 `report_order_info`(`consumeType=2`,**负数**) |
|
|
28
|
+
| 第二阶段 | `fix()` 按日重算 | `batchConsume()` 增量累加 |
|
|
29
|
+
| consumeType | **无此字段** | 1=消费,2=退款 |
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
ls leniu-tengyun-core/sys-canteen/src/main/java/.../report/statistics/
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**方法二:查看 git tag**
|
|
34
|
-
```bash
|
|
35
|
-
git tag --sort=-v:refname | head -5
|
|
36
|
-
# 标准版 tag 格式示例:v6.x.x、standard-xxx、core-report-xxx
|
|
37
|
-
# v5.29 tag 格式示例:v5.29.x
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**方法三:检查 report_order_info 表字段**
|
|
41
|
-
- 有 `consume_type` 字段 → v5.29 版本,使用 `leniu-report-customization`
|
|
42
|
-
- 无 `consume_type`,有独立 `report_refund` 表 → 标准版,使用本 skill
|
|
43
|
-
|
|
44
|
-
### 两版本核心差异速查
|
|
45
|
-
|
|
46
|
-
| 特性 | 标准版(本指南) | v5.29 版本 |
|
|
47
|
-
|------|--------------|-----------|
|
|
48
|
-
| 模块位置 | `core-report` 独立模块 | `sys-canteen` 内嵌 |
|
|
49
|
-
| 退款存储 | 独立 `report_refund` / `report_refund_detail` 表 | 合并入 `report_order_info`,`consumeType=2` |
|
|
50
|
-
| 退款金额 | **正数**存储,需手动减退 | **负数**存储,直接 SUM 即净额 |
|
|
51
|
-
| 第二阶段消费 | 用 `fix()` 按日重算 | 用 `batchConsume()` 增量累加 |
|
|
52
|
-
| report_order_info.consumeType | **无此字段** | 1=消费,2=退款 |
|
|
53
|
-
| 分析模块 | 完整引擎(6 大分析维度) | 无独立分析模块 |
|
|
54
|
-
|
|
55
|
-
> **v5.29 报表开发**请使用 `leniu-report-customization` skill。
|
|
56
|
-
> **钱包枚举(AccWalletIdEnum)、交易类型枚举(AccTradeTypeEnum)**与 v5.29 相同,参见 `leniu-report-customization`。
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 概述
|
|
61
|
-
|
|
62
|
-
本指南适用于 **标准版**(`core-report` 独立模块)的报表系统。
|
|
31
|
+
> v5.29 报表请使用 `leniu-report-customization`。钱包/交易类型枚举同 v5.29,参见该 skill。
|
|
63
32
|
|
|
64
33
|
---
|
|
65
34
|
|
|
66
35
|
## 一、报表系统架构
|
|
67
36
|
|
|
68
|
-
### 1.1
|
|
37
|
+
### 1.1 模块结构
|
|
69
38
|
|
|
70
39
|
```
|
|
71
|
-
core-report
|
|
72
|
-
├── config/mq/ #
|
|
73
|
-
├── constants/ # 枚举常量
|
|
40
|
+
core-report/.../statistics/
|
|
41
|
+
├── config/mq/ # MQ 监听器 + 消费调度 + 线程池
|
|
74
42
|
├── order/ # 订单报表(basic/summary/fix/analysis)
|
|
75
43
|
├── account/ # 账户流水报表
|
|
76
44
|
├── merchant/ # 商户维度报表
|
|
77
|
-
├── common/ #
|
|
78
|
-
|
|
79
|
-
└── vo/ # 公共 VO
|
|
45
|
+
├── common/ # 错误日志/定时任务
|
|
46
|
+
└── param/vo/constants/ # 公共类
|
|
80
47
|
```
|
|
81
48
|
|
|
82
49
|
### 1.2 三大 MQ 监听器
|
|
83
50
|
|
|
84
|
-
| 监听器 | Topic/Tag |
|
|
85
|
-
|
|
86
|
-
| `ReportOrderMQListener` | `order / order-v3-placed` |
|
|
87
|
-
| `ReportOrderRefundMQListener` | `order / order-v3-refunded` |
|
|
88
|
-
| `ReportAccountMQListener` | `acc / acc-trade-report-queue` |
|
|
51
|
+
| 监听器 | Topic/Tag |
|
|
52
|
+
|-------|-----------|
|
|
53
|
+
| `ReportOrderMQListener` | `order / order-v3-placed` |
|
|
54
|
+
| `ReportOrderRefundMQListener` | `order / order-v3-refunded` |
|
|
55
|
+
| `ReportAccountMQListener` | `acc / acc-trade-report-queue` |
|
|
89
56
|
|
|
90
57
|
### 1.3 两阶段消费模型
|
|
91
58
|
|
|
92
59
|
```
|
|
93
|
-
MQ 消息到达
|
|
94
|
-
↓
|
|
95
60
|
第一阶段(ORDER < 10,同步写基础表)
|
|
96
61
|
├── ORDER=1 ReportOrderInfoService → report_order_info
|
|
97
62
|
├── ORDER=2 ReportOrderDiscountService → report_order_discount
|
|
@@ -100,43 +65,29 @@ MQ 消息到达
|
|
|
100
65
|
├── ORDER=5 ReportRefundService → report_refund
|
|
101
66
|
├── ORDER=6 ReportRefundDetailService → report_refund_detail
|
|
102
67
|
└── ORDER=11 ReportOrderInfoSnapshotService → report_order_info_snapshot
|
|
103
|
-
|
|
104
|
-
第二阶段(ORDER >= 10
|
|
68
|
+
|
|
69
|
+
第二阶段(ORDER >= 10,fix 按日重算汇总表,由 Redis 计数触发)
|
|
105
70
|
├── ORDER=13 ReportSumMealtimeService → 分餐次汇总
|
|
106
71
|
├── ORDER=16 ReportSumPayService → 支付渠道汇总
|
|
107
72
|
├── ORDER=17 ReportSumPayMerService → 商户支付汇总
|
|
108
73
|
├── ORDER=18 ReportSumDishesService → 菜品销售汇总
|
|
109
|
-
├── ORDER=50 ReportAnalysisCustService →
|
|
74
|
+
├── ORDER=50 ReportAnalysisCustService → 用户分析
|
|
110
75
|
└── ORDER=51 ReportAnalysisDishesSaleService→ 菜品销售分析
|
|
111
76
|
```
|
|
112
77
|
|
|
113
78
|
### 1.4 第二阶段核心逻辑(fix 重算模式)
|
|
114
79
|
|
|
115
|
-
**关键区别**:标准版第二阶段使用 `fix()` 方法按日重算,而非 v5.29 的 `batchConsume()` 增量模式。
|
|
116
|
-
|
|
117
80
|
```java
|
|
118
81
|
// ReportConsumerService.consumeOrderReport()
|
|
119
82
|
void consumeOrderReport() {
|
|
120
83
|
for (TenantInfo tenant : allTenants) {
|
|
121
84
|
Executors.doInTenant(tenant.getId(), () -> {
|
|
122
85
|
RLock lock = RedisUtil.getLock(REPORT_ORDER_LOCK);
|
|
86
|
+
lock.lock(120, TimeUnit.MINUTES);
|
|
123
87
|
try {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// 菜品统计:按就餐日期(orderDate)分组
|
|
129
|
-
list.stream().collect(groupingBy(e -> e.getOrderDate()))
|
|
130
|
-
.forEach((date, items) -> reportSumDishesService.fix(buildParam(date)));
|
|
131
|
-
|
|
132
|
-
// 其他报表:按支付日期(statisticDate)分组
|
|
133
|
-
list.stream().collect(groupingBy(e -> e.getStatisticDate()))
|
|
134
|
-
.forEach((date, items) -> {
|
|
135
|
-
for (ReportOrderConsumeService svc : orderConsumeServices) {
|
|
136
|
-
if (svc.getOrder() >= 10) svc.fix(buildParam(date));
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
88
|
+
List<ReportNotConsumeDTO> list = reportOrderInfoService.queryNotConsumeData();
|
|
89
|
+
// 菜品:按 orderDate 分组调 fix
|
|
90
|
+
// 其他:按 statisticDate 分组,依次调所有 ORDER>=10 的 fix()
|
|
140
91
|
reportOrderInfoService.updateOrderMsg(list); // 标记已消费
|
|
141
92
|
} finally { lock.unlock(); }
|
|
142
93
|
});
|
|
@@ -144,114 +95,55 @@ void consumeOrderReport() {
|
|
|
144
95
|
}
|
|
145
96
|
```
|
|
146
97
|
|
|
147
|
-
|
|
98
|
+
**触发机制**:Redis 计数器每条消息递减,达阈值(默认100)触发 + XxlJob 定时兜底。
|
|
148
99
|
|
|
149
|
-
|
|
100
|
+
---
|
|
150
101
|
|
|
151
|
-
|
|
102
|
+
## 二、核心基础表概要
|
|
152
103
|
|
|
153
|
-
|
|
104
|
+
### 2.1 report_order_info(仅存正向订单,无 consumeType)
|
|
154
105
|
|
|
155
|
-
|
|
106
|
+
关键字段:`orderId`(主键), `canteenId/stallId`, `mealtimeType`, `orderType`, `payableAmount/realAmount/refundAmount`(分), `accPayAmount/outPayAmount`, `payTime/orderDate`, `orderRefundState`(1未退/2全退/3部分退), `status`(0未消费/1已消费), `nuClearMode`, `psnType`, `ageType/holidayType`
|
|
107
|
+
|
|
108
|
+
### 2.2 report_order_detail(菜品明细)
|
|
109
|
+
|
|
110
|
+
关键字段:`detailId`, `orderId`, `goodsDishesId/goodsDishesName`, `price/totalAmount/realAmount`(分), `quantity`, `salesMode`(1按份/2称重), `detailState`(1正常/2全退/3部分退), `goodsRefundNum`, `refundAmount`, `detailType`
|
|
111
|
+
|
|
112
|
+
### 2.3 report_refund / report_refund_detail(标准版特有,退款为正数)
|
|
156
113
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
> **关键**:标准版中此表**仅存正向订单**,退款数据存在独立的 `report_refund` 表中。无 `consumeType` 字段。
|
|
162
|
-
|
|
163
|
-
| 字段 | 类型 | 说明 |
|
|
164
|
-
|------|------|------|
|
|
165
|
-
| `orderId` | Long | 主键(雪花 ID) |
|
|
166
|
-
| `machineSn` | String | 设备 SN |
|
|
167
|
-
| `orgId/custId` | Long | 组织/人员 ID |
|
|
168
|
-
| `nuClearMode` | Integer | 核身方式(1刷卡/2刷脸/3扫码) |
|
|
169
|
-
| `sourceType/ifOnline` | Integer | 来源类型/是否在线(1是/2否) |
|
|
170
|
-
| `canteenId/stallId` | Long | 食堂/档口 ID |
|
|
171
|
-
| `mealtimeType` | Integer | 餐次(1早/2午/3下午茶/4晚/5夜宵) |
|
|
172
|
-
| `psnType` | Integer | 人员类别 |
|
|
173
|
-
| `payableAmount` | BigDecimal | 应付金额(分) |
|
|
174
|
-
| `discountsAmount` | BigDecimal | 优惠金额(分,取负数) |
|
|
175
|
-
| `deliveryAmount/packingAmount` | BigDecimal | 配送费/包装费(分) |
|
|
176
|
-
| `realAmount` | BigDecimal | 实付金额(分) |
|
|
177
|
-
| `accPayAmount/outPayAmount` | BigDecimal | 账户支付/外部支付金额(分) |
|
|
178
|
-
| `refundAmount` | BigDecimal | 累计退款金额(分) |
|
|
179
|
-
| `orderTime` | LocalDateTime | 下单时间 |
|
|
180
|
-
| `orderDate` | LocalDate | 就餐日期 |
|
|
181
|
-
| `orderType` | Integer | 订单类型(1当餐/2预订/3报餐/4扫码/5餐桌/6自助/11商城/12超市/21补扣/22外部) |
|
|
182
|
-
| `orderRefundState` | Integer | 退款状态(1未退/2已退/3部分退) |
|
|
183
|
-
| `payTime` | LocalDateTime | 支付时间 |
|
|
184
|
-
| `payType/payChannel` | Integer | 支付方式/渠道 |
|
|
185
|
-
| `ageType/holidayType` | Integer | 年龄段/节假日类型 |
|
|
186
|
-
| `status` | Integer | 消费状态(0未消费/1已消费) |
|
|
187
|
-
|
|
188
|
-
### 2.2 report_order_detail(订单菜品明细表)
|
|
189
|
-
|
|
190
|
-
| 字段 | 类型 | 说明 |
|
|
191
|
-
|------|------|------|
|
|
192
|
-
| `detailId` | Long | 明细主键 |
|
|
193
|
-
| `orderId` | Long | 关联订单 ID |
|
|
194
|
-
| `goodsDishesId/goodsDishesName` | Long/String | 菜品信息 |
|
|
195
|
-
| `salePrice/prefPrice/price` | BigDecimal | 售卖价/优惠价/最终价(分) |
|
|
196
|
-
| `weightUnit` | BigDecimal | 每份重量(g) |
|
|
197
|
-
| `quantity` | Integer | 数量/重量 |
|
|
198
|
-
| `salesMode` | Integer | 销售方式(1按份/2称重) |
|
|
199
|
-
| `detailType` | Integer | 类别(1菜品/2套餐/3商品/4按键/5补扣/6报餐) |
|
|
200
|
-
| `totalAmount/realAmount` | BigDecimal | 总金额/实付(分) |
|
|
201
|
-
| `detailState` | Integer | 状态(**1正常/2已退菜/3部分退菜**) |
|
|
202
|
-
| `goodsRefundNum` | Integer | 已退数量 |
|
|
203
|
-
| `refundAmount` | BigDecimal | 退款金额(分) |
|
|
204
|
-
|
|
205
|
-
### 2.3 report_refund / report_refund_detail(退款表,标准版特有)
|
|
206
|
-
|
|
207
|
-
**report_refund**:`orderRefundId`(主键), `orderId`(原始订单), `realRefundAmount`(退款金额,**正数**), `applyTime`, `applyType`(1退单/2纠错), `checkTime`
|
|
208
|
-
|
|
209
|
-
**report_refund_detail**:`orderRefundId`, `detailId`(菜品详情), `realQuantity`(退单数量), `realRefundAmount`(**正数**)
|
|
114
|
+
**report_refund**:`orderRefundId`(主键), `orderId`(原订单), `realRefundAmount`(**正数**), `applyType`(1退单/2纠错), `checkTime`
|
|
115
|
+
|
|
116
|
+
**report_refund_detail**:`orderRefundId`, `detailId`, `realQuantity`, `realRefundAmount`(**正数**)
|
|
210
117
|
|
|
211
118
|
### 2.4 其他基础表
|
|
212
119
|
|
|
213
|
-
- **report_order_pay**:`orderId`, `payType
|
|
214
|
-
- **report_order_discount**:`orderId`, `changeAmount`, `changeType`(1上浮/2优惠), `changeDetailType`
|
|
215
|
-
- **report_order_info_snapshot
|
|
120
|
+
- **report_order_pay**:`orderId`, `payType/payChannel`, `payAmount/refundAmount`
|
|
121
|
+
- **report_order_discount**:`orderId`, `changeAmount`, `changeType`(1上浮/2优惠), `changeDetailType`
|
|
122
|
+
- **report_order_info_snapshot**:订单交易快照
|
|
216
123
|
|
|
217
124
|
---
|
|
218
125
|
|
|
219
126
|
## 三、退款数据处理(核心重点)
|
|
220
127
|
|
|
221
|
-
### 3.1
|
|
128
|
+
### 3.1 存储模型
|
|
222
129
|
|
|
223
130
|
```
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
同时更新:report_order_info.orderRefundState = 2(全退) 或 3(部分退)
|
|
228
|
-
report_order_info.refundAmount = 累计退款金额
|
|
229
|
-
report_order_detail.detailState = 2 或 3
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### 3.2 退款 MQ 消费
|
|
233
|
-
|
|
234
|
-
```java
|
|
235
|
-
// ReportRefundService.consume() - 仅处理 REFUND 类型
|
|
236
|
-
if (!OrderChangeTypeEnum.REFUND.getKey().equals(payload.getChangeType())) return;
|
|
237
|
-
ReportRefund reportRefund = BeanUtil.copyProperties(payload.getOrderRefund(), ReportRefund.class);
|
|
238
|
-
baseMapper.insert(reportRefund);
|
|
239
|
-
// ReportRefundDetailService 同理,批量插入 refundDetailList
|
|
131
|
+
正向订单 → report_order_info(realAmount 为正)
|
|
132
|
+
退款记录 → report_refund(realRefundAmount 为正)+ report_refund_detail
|
|
133
|
+
同时更新 → report_order_info.orderRefundState + refundAmount
|
|
240
134
|
```
|
|
241
135
|
|
|
242
|
-
### 3.
|
|
136
|
+
### 3.2 净消费金额计算(3种方式)
|
|
243
137
|
|
|
244
|
-
**方式一:主表 refundAmount
|
|
138
|
+
**方式一:主表 refundAmount 减退(推荐)**
|
|
245
139
|
```sql
|
|
246
|
-
SELECT SUM(real_amount) AS
|
|
247
|
-
SUM(real_amount - IFNULL(refund_amount, 0)) AS netAmount
|
|
140
|
+
SELECT SUM(real_amount - IFNULL(refund_amount, 0)) AS netAmount
|
|
248
141
|
FROM report_order_info WHERE pay_time BETWEEN #{start} AND #{end}
|
|
249
142
|
```
|
|
250
143
|
|
|
251
|
-
|
|
144
|
+
**方式二:排除全退**
|
|
252
145
|
```sql
|
|
253
|
-
|
|
254
|
-
FROM report_order_info WHERE order_refund_state IN (1, 3)
|
|
146
|
+
WHERE order_refund_state IN (1, 3)
|
|
255
147
|
```
|
|
256
148
|
|
|
257
149
|
**方式三:关联 report_refund**
|
|
@@ -261,10 +153,9 @@ FROM report_order_info o LEFT JOIN report_refund r ON o.order_id = r.order_id
|
|
|
261
153
|
GROUP BY o.canteen_id
|
|
262
154
|
```
|
|
263
155
|
|
|
264
|
-
### 3.
|
|
156
|
+
### 3.3 菜品级别退款
|
|
265
157
|
|
|
266
158
|
```sql
|
|
267
|
-
-- 净销量 = 数量 - 已退数量,净金额 = 总金额 - 退款
|
|
268
159
|
SELECT goods_dishes_name,
|
|
269
160
|
SUM(quantity - IFNULL(goods_refund_num, 0)) AS netQuantity,
|
|
270
161
|
SUM(total_amount - IFNULL(refund_amount, 0)) AS netAmount
|
|
@@ -277,77 +168,48 @@ FROM report_order_detail WHERE detail_state IN (1, 3) GROUP BY goods_dishes_name
|
|
|
277
168
|
|
|
278
169
|
### 4.1 report_account_flow(流水主表)
|
|
279
170
|
|
|
280
|
-
核心字段:`flowId
|
|
281
|
-
|
|
282
|
-
附加字段:`rechargeOperate`(1单人/2批量/3导入/4赠送), `withdrawSource`(1小程序/2web/3openapi/4注销), `operateSource`(1手动清空/2批量/3定时/4注销)
|
|
283
|
-
|
|
284
|
-
### 4.2 report_account_flow_detail(流水钱包明细)
|
|
171
|
+
核心字段:`flowId`, `custId/orgId`, `payTime`, `flowType`(AccTradeTypeEnum), `flowRealAmount/flowAmount`, `manageCost`, `accTotalBal/accAllBal`, `status`
|
|
285
172
|
|
|
286
|
-
|
|
173
|
+
### 4.2 report_account_summary(用户账户日结表)
|
|
287
174
|
|
|
288
|
-
|
|
175
|
+
联合主键:`statisticDate` + `custId`。期末余额 = 期初 + 充值 - 撤销充值 + 补贴 - 撤销补贴 + 红包 + 赠送 - 消费 - 补扣 + 退款 - 提现 - 清空 - 管理费
|
|
289
176
|
|
|
290
|
-
|
|
177
|
+
### 4.3 AccountConsumeService 实现
|
|
291
178
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- withdrawAmount - clearAmount - manageCostAmount
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
附加维度:充值渠道详分(微信/支付宝/现金/银行/第三方)、提现渠道详分、各钱包余额及冻结金额
|
|
304
|
-
|
|
305
|
-
### 4.4 AccountConsumeService 实现类
|
|
306
|
-
|
|
307
|
-
| ORDER | 类名 | 汇总表 |
|
|
308
|
-
|-------|-----|-------|
|
|
309
|
-
| 1 | ReportAccountFlowService | report_account_flow(基础) |
|
|
310
|
-
| 2 | ReportAccountFlowDetailService | report_account_flow_detail(基础) |
|
|
311
|
-
| 13 | ReportAccountSummaryService | report_account_summary(日结) |
|
|
312
|
-
| 14 | ReportAccountOperatorService | report_account_operator(操作员) |
|
|
313
|
-
| 15 | ReportAccountConsumeSummaryService | report_account_consume(消费-个人) |
|
|
314
|
-
| 16 | ReportAccountConsumeSumOrgService | 消费-组织 |
|
|
315
|
-
| 17 | ReportAccountConsumeSumTypeService | 消费-用户类别 |
|
|
316
|
-
| 18 | ReportAccountWalletConsumeService | report_account_wallet_consume(钱包) |
|
|
317
|
-
| 19 | ReportSumRechargeMerService | report_sum_recharge_mer(商户充值) |
|
|
179
|
+
| ORDER | 类 | 汇总表 |
|
|
180
|
+
|-------|---|-------|
|
|
181
|
+
| 1/2 | Flow/FlowDetail | 基础表 |
|
|
182
|
+
| 13 | AccountSummary | 日结 |
|
|
183
|
+
| 14 | AccountOperator | 操作员 |
|
|
184
|
+
| 15-17 | ConsumeSummary/Org/Type | 消费维度 |
|
|
185
|
+
| 18 | WalletConsume | 钱包 |
|
|
186
|
+
| 19 | SumRechargeMer | 商户充值 |
|
|
318
187
|
|
|
319
188
|
---
|
|
320
189
|
|
|
321
190
|
## 五、汇总表开发标准模式
|
|
322
191
|
|
|
323
|
-
### 5.1
|
|
192
|
+
### 5.1 接口与实现
|
|
324
193
|
|
|
325
194
|
```java
|
|
326
|
-
public interface ReportOrderConsumeService extends Ordered {
|
|
327
|
-
void consume(OrderChangePO payload, ReportOrderInfoDTO baseInfo);
|
|
328
|
-
void fix(ReportBaseParam param);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
195
|
@Service @Slf4j
|
|
332
196
|
public class ReportSumXxxService implements ReportOrderConsumeService {
|
|
333
197
|
@Override public int getOrder() { return 15; } // 10-29普通,30+菜品,50+分析
|
|
334
198
|
|
|
335
199
|
@Override public void consume(OrderChangePO payload, ReportOrderInfoDTO baseInfo) {
|
|
336
|
-
//
|
|
200
|
+
// 标准版:留空,由 fix() 统一处理
|
|
337
201
|
}
|
|
338
202
|
|
|
339
203
|
@Override public void fix(ReportBaseParam param) {
|
|
340
204
|
LocalDateTime start = param.getStartPayTime(), end = param.getEndPayTime();
|
|
341
|
-
// 1. 删除旧数据
|
|
342
205
|
mapper.delete(Wrappers.<ReportSumXxx>lambdaQuery()
|
|
343
206
|
.between(ReportSumXxx::getStatisticDate, start.toLocalDate(), end.toLocalDate()));
|
|
344
|
-
// 2. 从基础表聚合写入
|
|
345
207
|
mapper.initFix(start, end);
|
|
346
208
|
}
|
|
347
209
|
}
|
|
348
210
|
```
|
|
349
211
|
|
|
350
|
-
### 5.2 fix SQL
|
|
212
|
+
### 5.2 fix SQL 模板
|
|
351
213
|
|
|
352
214
|
```xml
|
|
353
215
|
<insert id="initFix">
|
|
@@ -363,7 +225,7 @@ public class ReportSumXxxService implements ReportOrderConsumeService {
|
|
|
363
225
|
</insert>
|
|
364
226
|
```
|
|
365
227
|
|
|
366
|
-
### 5.3
|
|
228
|
+
### 5.3 查询接口(并行 + 权限)
|
|
367
229
|
|
|
368
230
|
```java
|
|
369
231
|
public ReportBaseTotalVO<XxxVO> pageSummary(XxxParam param) {
|
|
@@ -375,7 +237,7 @@ public ReportBaseTotalVO<XxxVO> pageSummary(XxxParam param) {
|
|
|
375
237
|
}
|
|
376
238
|
```
|
|
377
239
|
|
|
378
|
-
|
|
240
|
+
权限 SQL:
|
|
379
241
|
```xml
|
|
380
242
|
<if test="'-1'.toString() != authPO.roleType.toString()">
|
|
381
243
|
AND EXISTS (SELECT null FROM mgr_role_org it1
|
|
@@ -383,169 +245,84 @@ public ReportBaseTotalVO<XxxVO> pageSummary(XxxParam param) {
|
|
|
383
245
|
</if>
|
|
384
246
|
```
|
|
385
247
|
|
|
386
|
-
### 5.4 数据修复
|
|
387
|
-
|
|
388
|
-
```java
|
|
389
|
-
// ReportFixController - POST /summary/fix/order
|
|
390
|
-
// 限制: 日期范围不超过 31 天
|
|
391
|
-
// Redisson 分布式锁 (120 分钟)
|
|
392
|
-
// 按 ORDER 排序依次调用所有 Service.fix()
|
|
393
|
-
```
|
|
394
|
-
|
|
395
248
|
---
|
|
396
249
|
|
|
397
|
-
##
|
|
398
|
-
|
|
399
|
-
### 6.1 report_sum_mealtime(分餐次收入汇总)
|
|
400
|
-
|
|
401
|
-
维度:`statisticDate`, `canteenId/stallId`, `orgId`, `ageType`, `mealtimeType`, `psnType`, `machineSn`, `sourceType`
|
|
402
|
-
金额:`custNum`, `consumeNum`, `realAmount`, `refundAmount`, `totalAmount`, `payableAmount`, `discountAmount`
|
|
403
|
-
|
|
404
|
-
### 6.2 report_sum_pay(按支付渠道收入汇总)
|
|
250
|
+
## 六、汇总模型速查
|
|
405
251
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
金额:`quantity`, `realAmount`
|
|
252
|
+
| 表 | 维度 | 金额 |
|
|
253
|
+
|----|------|------|
|
|
254
|
+
| report_sum_mealtime | date/canteen/stall/org/age/mealtime/psn/machine/source | custNum/consumeNum/realAmount/refundAmount |
|
|
255
|
+
| report_sum_pay | date/mealtime/canteen/stall/org/age/payChannel/payType | payNum/realAmount/refundAmount |
|
|
256
|
+
| report_sum_dishes | date/area/canteen/stall/reportOrderType/mealtime/cook/device/dishes/salesMode/detailType | quantity/realAmount |
|
|
257
|
+
| report_sum_pay_mer | tenantId/date/payChannel/payType | custNum/payNum/realAmount/refundAmount |
|
|
413
258
|
|
|
414
259
|
---
|
|
415
260
|
|
|
416
261
|
## 七、经营分析模块
|
|
417
262
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
|
421
|
-
|
|
422
|
-
|
|
|
423
|
-
|
|
|
424
|
-
|
|
|
425
|
-
|
|
|
426
|
-
| 充值 | ReportAnalysisTurnoverService | 4 | `/summary/analysis/recharge/` |
|
|
427
|
-
| 设备 | ReportAnalysisTurnoverService | 2 | `/summary/analysis/device/` |
|
|
428
|
-
|
|
429
|
-
### 7.2 用户活跃度分析
|
|
430
|
-
|
|
431
|
-
分段枚举:`AnalysisConsumeTimesEnum`(次数:1-10/10-20/.../≥50)、`AnalysisConsumeAmountEnum`(金额:<200/200-400/.../≥1000元)、`AnalysisConsumeSlienceEnum`(沉默时长)
|
|
432
|
-
|
|
433
|
-
```java
|
|
434
|
-
// ReportAnalysisActiveVO
|
|
435
|
-
activeNumber/activePercent // 活跃用户
|
|
436
|
-
keepNumber/keepPercent // 保留用户
|
|
437
|
-
lossNumber/lossPercent // 流失用户
|
|
438
|
-
newNumber/newPercent // 新增用户
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
---
|
|
442
|
-
|
|
443
|
-
## 八、商户报表
|
|
444
|
-
|
|
445
|
-
**report_sum_pay_mer**:`tenantId`(商家ID), `statisticDate`, `payChannel`, `payType`, `custNum`, `payNum`, `realAmount`, `refundAmount`, `totalAmount`
|
|
446
|
-
|
|
447
|
-
**API**:`POST /report/merchant/summary/consume` (消费汇总) + `/recharge` (充值汇总)
|
|
263
|
+
| 分析 | Service | 路由前缀 |
|
|
264
|
+
|-----|---------|---------|
|
|
265
|
+
| 营业额 | ReportAnalysisTurnoverService | `/summary/analysis/turnover/` |
|
|
266
|
+
| 用户 | ReportAnalysisCustService (ORDER=50) | `/summary/analysis/cust/` |
|
|
267
|
+
| 菜品 | ReportAnalysisDishesSaleService (ORDER=51) | `/summary/analysis/dishes/` |
|
|
268
|
+
| 满意度 | ReportAnalysisEvaluateService | `/summary/analysis/evaluate/` |
|
|
269
|
+
| 充值 | ReportAnalysisTurnoverService | `/summary/analysis/recharge/` |
|
|
270
|
+
| 设备 | ReportAnalysisTurnoverService | `/summary/analysis/device/` |
|
|
448
271
|
|
|
449
272
|
---
|
|
450
273
|
|
|
451
|
-
##
|
|
274
|
+
## 八、公共模块
|
|
452
275
|
|
|
453
|
-
|
|
276
|
+
- **报表错误日志**(report_error_log):`reportErrorType`(1账户/2订单), `reportErrorState`(1已创建/2已处理)。定时任务 `@XxlJob("reportExceptionHandle")` 自动修复。
|
|
277
|
+
- **金额范围设置**:`POST /report/alloc/amount-scope/save`
|
|
278
|
+
- **数据修复**:`POST /summary/fix/order|account`(限31天,Redisson 锁 120 分钟)
|
|
454
279
|
|
|
455
|
-
|
|
280
|
+
### 核心枚举
|
|
456
281
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
### 9.3 核心枚举
|
|
462
|
-
|
|
463
|
-
| 枚举 | 说明 |
|
|
464
|
-
|------|------|
|
|
465
|
-
| `ReportClassifyEnum` | 报表分类:1组织/2用户类别/3食堂档口/4设备/5营业收入/6支付渠道/7餐次 |
|
|
466
|
-
| `ReportPayTypeEnum` | 支付方式:1微信/2支付宝/3系统账户/4-8银行/9现金/10收钱吧/20其他 |
|
|
467
|
-
| `ReportSumTypeEnum` | 汇总类型:1按时段/2按日期 |
|
|
468
|
-
| `ReportMsgStatusEnum` | 消费状态:0未消费/1已消费 |
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
## 十、公共参数类
|
|
473
|
-
|
|
474
|
-
```java
|
|
475
|
-
// ReportBaseParam(所有查询参数基类)
|
|
476
|
-
PageDTO page; LocalDate startDate/endDate; LocalDate startOrderDate/endOrderDate;
|
|
477
|
-
Integer sumType; Integer sumDimension; List<Integer> ageTypes; List<Integer> holidayTypeList;
|
|
478
|
-
List<String> exportCols; LocalDateTime startPayTime/endPayTime;
|
|
479
|
-
|
|
480
|
-
// ReportNotConsumeDTO(未消费数据)
|
|
481
|
-
String statisticDate; // 统计日期(支付日期)
|
|
482
|
-
String orderDate; // 就餐日期(菜品统计专用)
|
|
483
|
-
Long relationId;
|
|
484
|
-
|
|
485
|
-
// 支付信息编码: "支付方式-支付渠道-支付金额" 如 "1-1-1200;2-4-1200"
|
|
486
|
-
// 优惠信息编码: "变动类型,详情类型,金额" 如 "1,1,100;2,11,200"
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
---
|
|
490
|
-
|
|
491
|
-
## 十一、API 路由总览
|
|
492
|
-
|
|
493
|
-
| 模块 | 前缀 | 核心接口 |
|
|
494
|
-
|------|------|---------|
|
|
495
|
-
| 营业收入明细 | `/summary/basic/` | flow/page, cust/page, remote/detail/page, remote/summary/page |
|
|
496
|
-
| 订单汇总 | `/summary/order/` | organization/pay/type/classify/mealtime/dishes |
|
|
497
|
-
| 账户流水 | `/summary/account/` | flow/cust/psn/organization/operator/consume/recharge/wallet/data |
|
|
498
|
-
| 经营分析 | `/summary/analysis/` | turnover(6)/cust(8)/dishes(10)/recharge(4)/device(2)/evaluate(2) |
|
|
499
|
-
| 数据修复 | `/summary/fix/` | order, account (限31天) |
|
|
500
|
-
| 商户 | `/report/merchant/summary/` | consume, recharge |
|
|
282
|
+
| 枚举 | 值 |
|
|
283
|
+
|------|---|
|
|
284
|
+
| ReportClassifyEnum | 1组织/2类别/3食堂/4设备/5收入/6渠道/7餐次 |
|
|
285
|
+
| ReportPayTypeEnum | 1微信/2支付宝/3系统账户/9现金/20其他 |
|
|
501
286
|
|
|
502
287
|
---
|
|
503
288
|
|
|
504
|
-
##
|
|
289
|
+
## 九、开发检查清单
|
|
505
290
|
|
|
506
291
|
### 建表
|
|
507
|
-
- [ ]
|
|
508
|
-
- [ ] 审计字段(crby/crtime/upby/uptime/del_flag),无 tenant_id
|
|
292
|
+
- [ ] 分组维度 + 金额汇总 + 审计字段(crby/crtime/upby/uptime/del_flag),无 tenant_id
|
|
509
293
|
|
|
510
294
|
### 实现
|
|
511
|
-
- [ ] 实现 `ReportOrderConsumeService
|
|
512
|
-
- [ ] `fix()`
|
|
513
|
-
- [ ] `consume()` 可留空(汇总表由 fix 重算)
|
|
295
|
+
- [ ] 实现 `ReportOrderConsumeService`,设 `getOrder()`
|
|
296
|
+
- [ ] `fix()` 先删后插(**标准版核心模式**),`consume()` 留空
|
|
514
297
|
|
|
515
|
-
###
|
|
298
|
+
### 退款(标准版特有)
|
|
516
299
|
- [ ] 退款在独立 `report_refund` 表(**正数金额**)
|
|
517
300
|
- [ ] 净消费 = `real_amount - IFNULL(refund_amount, 0)`
|
|
518
|
-
- [ ] **不要使用 consumeType
|
|
301
|
+
- [ ] **不要使用 consumeType 字段**
|
|
519
302
|
|
|
520
|
-
###
|
|
303
|
+
### 查询
|
|
521
304
|
- [ ] ReportBaseTotalVO + CompletableFuture 并行 + MgrUserAuthPO 权限
|
|
522
305
|
|
|
523
306
|
---
|
|
524
307
|
|
|
525
|
-
##
|
|
308
|
+
## 十、关键代码位置
|
|
309
|
+
|
|
310
|
+
> 路径前缀均为 `core-report/.../statistics/`
|
|
526
311
|
|
|
527
312
|
| 类型 | 路径 |
|
|
528
313
|
|------|------|
|
|
529
314
|
| MQ 监听器 | `config/mq/ReportOrderMQListener.java` / `ReportAccountMQListener.java` |
|
|
530
315
|
| 消费调度 | `config/mq/service/ReportConsumerService.java` |
|
|
531
|
-
|
|
|
532
|
-
|
|
|
533
|
-
|
|
|
534
|
-
|
|
|
535
|
-
| Fix | `order/fix/controller/ReportFixController.java`
|
|
536
|
-
| 汇总 Service | `order/summary/service/ReportSumMealtimeService.java` / `ReportSumPayService.java` / `ReportSumDishesService.java` |
|
|
537
|
-
| 分析 Service | `order/analysis/service/ReportAnalysisTurnoverService.java` / `ReportAnalysisCustService.java` |
|
|
538
|
-
| 账户 | `account/service/ReportAccountFlowService.java` / `ReportAccountSummaryService.java` |
|
|
539
|
-
| 商户 | `merchant/service/ReportSumPayMerService.java` |
|
|
540
|
-
| 公共 | `common/model/ReportErrorLog.java` / `common/task/ReportTask.java` / `constants/ReportConstant.java` |
|
|
541
|
-
|
|
542
|
-
> 路径前缀均为 `core-report/.../statistics/`
|
|
316
|
+
| 订单基础表 | `order/basic/model/ReportOrderInfo.java` / `ReportRefund.java` |
|
|
317
|
+
| 汇总 Service | `order/summary/service/ReportSumMealtimeService.java` / `ReportSumPayService.java` |
|
|
318
|
+
| 分析 Service | `order/analysis/service/ReportAnalysisTurnoverService.java` |
|
|
319
|
+
| 账户 Service | `account/service/ReportAccountSummaryService.java` |
|
|
320
|
+
| Fix | `order/fix/controller/ReportFixController.java` |
|
|
543
321
|
|
|
544
322
|
---
|
|
545
323
|
|
|
546
324
|
## 注意
|
|
547
325
|
|
|
548
|
-
- 本指南适用于**标准版**(core-report),v5.29 版本请使用 `leniu-report-customization`
|
|
549
326
|
- 标准版退款为独立表(正数金额),**不要使用 consumeType 字段**
|
|
550
327
|
- 标准版第二阶段用 `fix()` 按日重算,**不要使用 batchConsume() 增量模式**
|
|
551
|
-
- CRUD
|
|
328
|
+
- CRUD 用 `leniu-crud-development`,MyBatis 用 `leniu-java-mybatis`,入参用 `leniu-java-report-query-param`,合计行用 `leniu-java-total-line`,餐次用 `leniu-mealtime`
|