ai-engineering-init 1.16.2 → 1.16.4
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/skills/code-patterns/SKILL.md +0 -119
- package/.claude/skills/codex-code-review/SKILL.md +0 -39
- package/.claude/skills/fix-bug/SKILL.md +57 -0
- package/.claude/skills/leniu-code-patterns/SKILL.md +2 -179
- package/.claude/skills/leniu-crud-development/SKILL.md +7 -26
- package/.claude/skills/leniu-java-mybatis/SKILL.md +16 -25
- package/.claude/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.claude/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.claude/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.claude/skills/leniu-report-scenario/references/export.md +553 -0
- package/.claude/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.claude/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.claude/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.claude/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.claude/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.claude/skills/loki-log-query/SKILL.md +30 -33
- package/.claude/skills/mysql-debug/SKILL.md +17 -35
- package/.codex/skills/code-patterns/SKILL.md +0 -119
- package/.codex/skills/fix-bug/SKILL.md +57 -0
- package/.codex/skills/leniu-code-patterns/SKILL.md +2 -179
- package/.codex/skills/leniu-crud-development/SKILL.md +7 -26
- package/.codex/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +16 -25
- package/.codex/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.codex/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.codex/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.codex/skills/leniu-report-scenario/references/export.md +553 -0
- package/.codex/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.codex/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.codex/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.codex/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.codex/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.codex/skills/loki-log-query/SKILL.md +55 -25
- package/.codex/skills/mysql-debug/SKILL.md +12 -6
- package/.cursor/skills/code-patterns/SKILL.md +0 -119
- package/.cursor/skills/fix-bug/SKILL.md +57 -0
- package/.cursor/skills/leniu-code-patterns/SKILL.md +2 -179
- package/.cursor/skills/leniu-crud-development/SKILL.md +7 -26
- package/.cursor/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +16 -25
- package/.cursor/skills/leniu-report-scenario/references/amount-handling.md +448 -0
- package/.cursor/skills/leniu-report-scenario/references/analysis-module.md +64 -0
- package/.cursor/skills/leniu-report-scenario/references/customization-table-fields.md +93 -0
- package/.cursor/skills/leniu-report-scenario/references/export.md +553 -0
- package/.cursor/skills/leniu-report-scenario/references/mealtime.md +197 -0
- package/.cursor/skills/leniu-report-scenario/references/query-param.md +274 -0
- package/.cursor/skills/leniu-report-scenario/references/standard-customization.md +112 -0
- package/.cursor/skills/leniu-report-scenario/references/standard-table-fields.md +113 -0
- package/.cursor/skills/leniu-report-scenario/references/total-line.md +179 -0
- package/.cursor/skills/loki-log-query/SKILL.md +30 -33
- package/.cursor/skills/mysql-debug/SKILL.md +20 -36
- package/CLAUDE.md +34 -0
- package/package.json +1 -1
- package/src/skills/fix-bug/SKILL.md +57 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
|
|
2
|
+
# leniu-tengyun-core 餐次处理规范
|
|
3
|
+
|
|
4
|
+
## 餐次枚举定义
|
|
5
|
+
|
|
6
|
+
### AllocMealtimeTypeEnum
|
|
7
|
+
|
|
8
|
+
餐次类型枚举 `AllocMealtimeTypeEnum` 定义了5种餐次:
|
|
9
|
+
|
|
10
|
+
| 枚举值 | key | 显示名称 | 说明 |
|
|
11
|
+
|--------|-----|----------|------|
|
|
12
|
+
| MEALTIME_BREAKFAST | 1 | 早餐 | 早餐 |
|
|
13
|
+
| MEALTIME_LUNCH | 2 | 午餐 | 午餐 |
|
|
14
|
+
| MEALTIME_AFTERNOON_TEA | 3 | 下午茶 | 下午茶 |
|
|
15
|
+
| MEALTIME_DINNER | 4 | 晚餐 | 晚餐 |
|
|
16
|
+
| MEALTIME_MIDNIGHT_SNACK | 5 | 夜宵 | 夜宵 |
|
|
17
|
+
|
|
18
|
+
### 常用方法
|
|
19
|
+
|
|
20
|
+
```java
|
|
21
|
+
// 根据key获取枚举
|
|
22
|
+
AllocMealtimeTypeEnum typeEnum = AllocMealtimeTypeEnum.getTypeEnum(1);
|
|
23
|
+
|
|
24
|
+
// 根据key获取显示名称
|
|
25
|
+
String desc = AllocMealtimeTypeEnum.getValueByKey(1); // 返回 "早餐"
|
|
26
|
+
|
|
27
|
+
// 获取所有餐次key列表
|
|
28
|
+
List<Integer> allTypes = AllocMealtimeTypeEnum.allTypeList(); // [1, 2, 3, 4, 5]
|
|
29
|
+
|
|
30
|
+
// 获取正餐类型列表
|
|
31
|
+
List<Integer> normalTypes = AllocMealtimeTypeEnum.normalTypeList(); // [1, 2, 4]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 餐次分类
|
|
35
|
+
|
|
36
|
+
- **正餐**:早餐(1)、午餐(2)、晚餐(4)
|
|
37
|
+
- **非正餐**:下午茶(3)、夜宵(5)
|
|
38
|
+
|
|
39
|
+
## 查询参数中的餐次处理
|
|
40
|
+
|
|
41
|
+
### Param类定义
|
|
42
|
+
|
|
43
|
+
在报表查询Param类中添加餐次筛选字段:
|
|
44
|
+
|
|
45
|
+
```java
|
|
46
|
+
@ApiModelProperty(value = "餐次集合")
|
|
47
|
+
private List<Integer> mealtimeTypes;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 完整示例
|
|
51
|
+
|
|
52
|
+
```java
|
|
53
|
+
@Data
|
|
54
|
+
@AllArgsConstructor
|
|
55
|
+
@NoArgsConstructor
|
|
56
|
+
@EqualsAndHashCode(callSuper = true)
|
|
57
|
+
@ApiModel(value = "XXX查询入参")
|
|
58
|
+
public class XxxParam extends ReportBaseParam {
|
|
59
|
+
|
|
60
|
+
@ApiModelProperty(value = "餐次集合")
|
|
61
|
+
private List<Integer> mealtimeTypes;
|
|
62
|
+
|
|
63
|
+
// 其他查询字段...
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 返回VO中的餐次处理
|
|
68
|
+
|
|
69
|
+
### VO字段定义
|
|
70
|
+
|
|
71
|
+
在报表返回VO类中定义餐次字段:
|
|
72
|
+
|
|
73
|
+
```java
|
|
74
|
+
@Data
|
|
75
|
+
@Accessors(chain = true)
|
|
76
|
+
@ApiModel(value = "XXX报表")
|
|
77
|
+
public class XxxVO {
|
|
78
|
+
|
|
79
|
+
@ExcelProperty(value = "餐次", order = 5, converter = MealtimeTypeConverter.class)
|
|
80
|
+
@ApiModelProperty(value = "餐次")
|
|
81
|
+
private Integer mealtimeType;
|
|
82
|
+
|
|
83
|
+
// 其他字段...
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 必要的导入
|
|
88
|
+
|
|
89
|
+
```java
|
|
90
|
+
import com.alibaba.excel.annotation.ExcelProperty;
|
|
91
|
+
import net.xnzn.core.common.export.converter.MealtimeTypeConverter;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 字段说明
|
|
95
|
+
|
|
96
|
+
- `mealtimeType`: 存储餐次的整数key值(1-5)
|
|
97
|
+
- `@ExcelProperty`: 配置EasyExcel导出,使用`MealtimeTypeConverter`进行转换
|
|
98
|
+
- `converter = MealtimeTypeConverter.class`: 自动将整数转换为可读的餐次名称
|
|
99
|
+
|
|
100
|
+
## MyBatis XML中的餐次查询
|
|
101
|
+
|
|
102
|
+
### 基本IN查询
|
|
103
|
+
|
|
104
|
+
```xml
|
|
105
|
+
<!-- 餐次筛选 -->
|
|
106
|
+
<if test="mealtimeTypes != null and mealtimeTypes.size() > 0">
|
|
107
|
+
AND mealtime_type IN
|
|
108
|
+
<foreach collection="mealtimeTypes" item="type" open="(" separator="," close=")">
|
|
109
|
+
#{type}
|
|
110
|
+
</foreach>
|
|
111
|
+
</if>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 正餐筛选
|
|
115
|
+
|
|
116
|
+
```xml
|
|
117
|
+
<!-- 仅查询正餐(早餐、午餐、晚餐) -->
|
|
118
|
+
AND mealtime_type IN (1, 2, 4)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 完整示例
|
|
122
|
+
|
|
123
|
+
```xml
|
|
124
|
+
<select id="pageXxx" resultType="net.xnzn.core.xxx.vo.XxxVO">
|
|
125
|
+
SELECT
|
|
126
|
+
id,
|
|
127
|
+
order_date,
|
|
128
|
+
mealtime_type,
|
|
129
|
+
cust_name,
|
|
130
|
+
real_amount
|
|
131
|
+
FROM order_table
|
|
132
|
+
WHERE del_flag = 2
|
|
133
|
+
<if test="startDate != null">
|
|
134
|
+
AND order_date >= #{startDate}
|
|
135
|
+
</if>
|
|
136
|
+
<if test="endDate != null">
|
|
137
|
+
AND order_date <= #{endDate}
|
|
138
|
+
</if>
|
|
139
|
+
<if test="mealtimeTypes != null and mealtimeTypes.size() > 0">
|
|
140
|
+
AND mealtime_type IN
|
|
141
|
+
<foreach collection="mealtimeTypes" item="type" open="(" separator="," close=")">
|
|
142
|
+
#{type}
|
|
143
|
+
</foreach>
|
|
144
|
+
</if>
|
|
145
|
+
<if test="canteenId != null">
|
|
146
|
+
AND canteen_id = #{canteenId}
|
|
147
|
+
</if>
|
|
148
|
+
ORDER BY order_date DESC
|
|
149
|
+
</select>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 常见使用场景
|
|
153
|
+
|
|
154
|
+
### 场景1:查询指定餐次的订单
|
|
155
|
+
|
|
156
|
+
```java
|
|
157
|
+
// Param定义
|
|
158
|
+
@ApiModelProperty(value = "餐次集合")
|
|
159
|
+
private List<Integer> mealtimeTypes;
|
|
160
|
+
|
|
161
|
+
// Service调用
|
|
162
|
+
List<Integer> mealtimeTypes = Arrays.asList(1, 2); // 查询早餐和午餐
|
|
163
|
+
param.setMealtimeTypes(mealtimeTypes);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 场景2:仅查询正餐
|
|
167
|
+
|
|
168
|
+
```java
|
|
169
|
+
// 方式1:直接在XML中硬编码
|
|
170
|
+
AND mealtime_type IN (1, 2, 4)
|
|
171
|
+
|
|
172
|
+
// 方式2:使用枚举工具类
|
|
173
|
+
param.setMealtimeTypes(AllocMealtimeTypeEnum.normalTypeList());
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 场景3:导出时餐次列显示中文名称
|
|
177
|
+
|
|
178
|
+
```java
|
|
179
|
+
// VO定义
|
|
180
|
+
@ExcelProperty(value = "餐次", order = 5, converter = MealtimeTypeConverter.class)
|
|
181
|
+
@ApiModelProperty(value = "餐次")
|
|
182
|
+
private Integer mealtimeType;
|
|
183
|
+
|
|
184
|
+
// 导出时自动转换:1 -> "早餐",2 -> "午餐" 等
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 注意事项
|
|
188
|
+
|
|
189
|
+
1. **字段命名**:统一使用 `mealtimeType` (驼峰) 或 `mealtime_type` (下划线)
|
|
190
|
+
2. **类型**:数据库和Java代码中均使用 `Integer` 类型
|
|
191
|
+
3. **转换器**:导出时必须使用 `MealtimeTypeConverter` 进行转换
|
|
192
|
+
4. **国际化的影响**:显示名称根据项目配置可能使用中文或国际化key
|
|
193
|
+
5. **正餐判断**:需要区分正餐时使用 `AllocMealtimeTypeEnum.normalTypeList()` 方法
|
|
194
|
+
|
|
195
|
+
## 参考文档
|
|
196
|
+
|
|
197
|
+
详见:[leniu-tengyun-core 源码](/Users/xujiajun/Developer/gongsi_proj/core/leniu-tengyun-core)
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
|
|
2
|
+
# leniu-tengyun-core 报表查询入参规范
|
|
3
|
+
|
|
4
|
+
## 项目特征
|
|
5
|
+
|
|
6
|
+
| 特征 | 说明 |
|
|
7
|
+
|------|------|
|
|
8
|
+
| **包名前缀** | `net.xnzn.core.*` |
|
|
9
|
+
| **JDK 版本** | 21 |
|
|
10
|
+
| **请求封装** | `LeRequest<T>` |
|
|
11
|
+
| **分页参数** | `PageDTO` |
|
|
12
|
+
| **基类** | `ReportBaseParam` |
|
|
13
|
+
| **校验框架** | Jakarta Validation |
|
|
14
|
+
|
|
15
|
+
## 核心结构
|
|
16
|
+
|
|
17
|
+
### 1. Controller层接收入参
|
|
18
|
+
|
|
19
|
+
```java
|
|
20
|
+
import com.pig4cloud.pigx.common.core.util.LeRequest;
|
|
21
|
+
|
|
22
|
+
@PostMapping("/page")
|
|
23
|
+
public ReportBaseTotalVO<XxxVO> pageXxxSummary(@RequestBody LeRequest<XxxParam> request) {
|
|
24
|
+
XxxParam param = request.getContent();
|
|
25
|
+
return xxxService.pageSummary(param);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Param类基类继承
|
|
30
|
+
|
|
31
|
+
报表查询Param类**必须继承** `ReportBaseParam`:
|
|
32
|
+
|
|
33
|
+
```java
|
|
34
|
+
import lombok.Data;
|
|
35
|
+
import lombok.EqualsAndHashCode;
|
|
36
|
+
import io.swagger.annotations.ApiModel;
|
|
37
|
+
import io.swagger.annotations.ApiModelProperty;
|
|
38
|
+
import net.xnzn.core.common.page.PageDTO;
|
|
39
|
+
import net.xnzn.core.common.param.ReportBaseParam;
|
|
40
|
+
|
|
41
|
+
import java.time.LocalDate;
|
|
42
|
+
import java.util.List;
|
|
43
|
+
|
|
44
|
+
@Data
|
|
45
|
+
@EqualsAndHashCode(callSuper = true)
|
|
46
|
+
@ApiModel(value = "XXX查询入参")
|
|
47
|
+
public class XxxParam extends ReportBaseParam {
|
|
48
|
+
|
|
49
|
+
@ApiModelProperty("关键字")
|
|
50
|
+
private String keyword;
|
|
51
|
+
|
|
52
|
+
@ApiModelProperty("状态")
|
|
53
|
+
private Integer status;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. ReportBaseParam 提供的通用字段
|
|
58
|
+
|
|
59
|
+
| 字段名 | 类型 | 说明 |
|
|
60
|
+
|--------|------|------|
|
|
61
|
+
| `page` | `PageDTO` | 分页参数 |
|
|
62
|
+
| `startDate` | `LocalDate` | 开始时间 |
|
|
63
|
+
| `endDate` | `LocalDate` | 结束时间 |
|
|
64
|
+
| `exportCols` | `List<String>` | 需要导出的列 |
|
|
65
|
+
| `sumType` | `Integer` | 汇总类型 |
|
|
66
|
+
| `sumDimension` | `Integer` | 统计维度 |
|
|
67
|
+
|
|
68
|
+
## 常用查询字段模式
|
|
69
|
+
|
|
70
|
+
### 时间范围查询
|
|
71
|
+
|
|
72
|
+
```java
|
|
73
|
+
@Data
|
|
74
|
+
@EqualsAndHashCode(callSuper = true)
|
|
75
|
+
@ApiModel("订单报表查询参数")
|
|
76
|
+
public class OrderReportParam extends ReportBaseParam {
|
|
77
|
+
|
|
78
|
+
// 基类已有 startDate, endDate
|
|
79
|
+
|
|
80
|
+
@ApiModelProperty("开始时间(精确到秒)")
|
|
81
|
+
private LocalDateTime startTime;
|
|
82
|
+
|
|
83
|
+
@ApiModelProperty("结束时间(精确到秒)")
|
|
84
|
+
private LocalDateTime endTime;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 组织筛选
|
|
89
|
+
|
|
90
|
+
```java
|
|
91
|
+
@Data
|
|
92
|
+
@EqualsAndHashCode(callSuper = true)
|
|
93
|
+
@ApiModel("组织报表查询参数")
|
|
94
|
+
public class OrgReportParam extends ReportBaseParam {
|
|
95
|
+
|
|
96
|
+
@ApiModelProperty("组织ID")
|
|
97
|
+
private Long orgId;
|
|
98
|
+
|
|
99
|
+
@ApiModelProperty("组织ID列表")
|
|
100
|
+
private List<Long> orgIds;
|
|
101
|
+
|
|
102
|
+
@ApiModelProperty("食堂ID")
|
|
103
|
+
private Long canteenId;
|
|
104
|
+
|
|
105
|
+
@ApiModelProperty("食堂ID列表")
|
|
106
|
+
private List<Long> canteenIds;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 餐次筛选
|
|
111
|
+
|
|
112
|
+
```java
|
|
113
|
+
@Data
|
|
114
|
+
@EqualsAndHashCode(callSuper = true)
|
|
115
|
+
@ApiModel("餐次报表查询参数")
|
|
116
|
+
public class MealtimeReportParam extends ReportBaseParam {
|
|
117
|
+
|
|
118
|
+
@ApiModelProperty("餐次类型列表")
|
|
119
|
+
private List<Integer> mealtimeTypes;
|
|
120
|
+
|
|
121
|
+
@ApiModelProperty("是否只查正餐")
|
|
122
|
+
private Boolean onlyMainMeal;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 金额范围
|
|
127
|
+
|
|
128
|
+
```java
|
|
129
|
+
@Data
|
|
130
|
+
@EqualsAndHashCode(callSuper = true)
|
|
131
|
+
@ApiModel("金额报表查询参数")
|
|
132
|
+
public class AmountReportParam extends ReportBaseParam {
|
|
133
|
+
|
|
134
|
+
@ApiModelProperty("最小金额(分)")
|
|
135
|
+
private Long minAmount;
|
|
136
|
+
|
|
137
|
+
@ApiModelProperty("最大金额(分)")
|
|
138
|
+
private Long maxAmount;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## PageDTO 结构
|
|
143
|
+
|
|
144
|
+
```java
|
|
145
|
+
@Data
|
|
146
|
+
@ApiModel("分页参数")
|
|
147
|
+
public class PageDTO {
|
|
148
|
+
|
|
149
|
+
@ApiModelProperty("当前页码")
|
|
150
|
+
private Integer current = 1;
|
|
151
|
+
|
|
152
|
+
@ApiModelProperty("每页条数")
|
|
153
|
+
private Integer size = 10;
|
|
154
|
+
|
|
155
|
+
@ApiModelProperty("是否查询总数")
|
|
156
|
+
private Boolean ifCount = true;
|
|
157
|
+
|
|
158
|
+
@ApiModelProperty("页数为0时的处理")
|
|
159
|
+
private Boolean ifPageSizeZero = false;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 完整示例
|
|
164
|
+
|
|
165
|
+
```java
|
|
166
|
+
@Data
|
|
167
|
+
@EqualsAndHashCode(callSuper = true)
|
|
168
|
+
@ApiModel("销售报表查询参数")
|
|
169
|
+
public class SalesReportParam extends ReportBaseParam {
|
|
170
|
+
|
|
171
|
+
@ApiModelProperty(value = "关键字")
|
|
172
|
+
private String keyword;
|
|
173
|
+
|
|
174
|
+
@ApiModelProperty(value = "组织ID列表")
|
|
175
|
+
private List<Long> orgIds;
|
|
176
|
+
|
|
177
|
+
@ApiModelProperty(value = "食堂ID列表")
|
|
178
|
+
private List<Long> canteenIds;
|
|
179
|
+
|
|
180
|
+
@ApiModelProperty(value = "餐次类型列表")
|
|
181
|
+
private List<Integer> mealtimeTypes;
|
|
182
|
+
|
|
183
|
+
@ApiModelProperty(value = "支付方式列表")
|
|
184
|
+
private List<Integer> payTypes;
|
|
185
|
+
|
|
186
|
+
@ApiModelProperty(value = "最小金额(分)")
|
|
187
|
+
private Long minAmount;
|
|
188
|
+
|
|
189
|
+
@ApiModelProperty(value = "最大金额(分)")
|
|
190
|
+
private Long maxAmount;
|
|
191
|
+
|
|
192
|
+
@ApiModelProperty(value = "是否查询合计行")
|
|
193
|
+
private Boolean ifQueryTotal = true;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 两层继承结构(实际生产代码模式)
|
|
198
|
+
|
|
199
|
+
报表 Param 存在两层继承结构,以订单分析报表为例:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
ReportAnalysisParam(大类基类:订单分析类报表通用字段)
|
|
203
|
+
└── ReportAnalysisTurnoverParam(具体报表 Param,加业务字段)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### ReportAnalysisParam(中间基类)
|
|
207
|
+
|
|
208
|
+
```java
|
|
209
|
+
import lombok.Data;
|
|
210
|
+
import net.xnzn.core.common.page.PageDTO;
|
|
211
|
+
|
|
212
|
+
import java.time.LocalDate;
|
|
213
|
+
import java.util.List;
|
|
214
|
+
|
|
215
|
+
@Data
|
|
216
|
+
public class ReportAnalysisParam {
|
|
217
|
+
|
|
218
|
+
/** 分页参数 */
|
|
219
|
+
private PageDTO page;
|
|
220
|
+
|
|
221
|
+
/** 开始日期 */
|
|
222
|
+
private LocalDate startDate;
|
|
223
|
+
|
|
224
|
+
/** 结束日期 */
|
|
225
|
+
private LocalDate endDate;
|
|
226
|
+
|
|
227
|
+
/** 日期维度:1=按月 2=按日 */
|
|
228
|
+
private Integer dateType;
|
|
229
|
+
|
|
230
|
+
/** 食堂摊位ID列表(多选) */
|
|
231
|
+
private List<Long> canteenStallIds;
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### ReportAnalysisTurnoverParam(具体 Param,继承中间基类)
|
|
236
|
+
|
|
237
|
+
```java
|
|
238
|
+
import lombok.Data;
|
|
239
|
+
import lombok.EqualsAndHashCode;
|
|
240
|
+
|
|
241
|
+
import java.util.List;
|
|
242
|
+
|
|
243
|
+
@Data
|
|
244
|
+
@EqualsAndHashCode(callSuper = true)
|
|
245
|
+
public class ReportAnalysisTurnoverParam extends ReportAnalysisParam {
|
|
246
|
+
|
|
247
|
+
/** 餐次类型(单选) */
|
|
248
|
+
private Integer mealtimeType;
|
|
249
|
+
|
|
250
|
+
/** 餐次类型列表(多选) */
|
|
251
|
+
private List<Integer> mealtimeTypeList;
|
|
252
|
+
|
|
253
|
+
/** 排序类型:1=按金额降序(默认) */
|
|
254
|
+
private Integer sortType = 1;
|
|
255
|
+
|
|
256
|
+
/** 食堂ID(单选) */
|
|
257
|
+
private Long canteenId;
|
|
258
|
+
|
|
259
|
+
/** 摊位ID(单选) */
|
|
260
|
+
private Long stallId;
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**选择继承层级的判断依据**:
|
|
265
|
+
- 若报表是"订单分析"大类报表 → 继承 `ReportAnalysisParam`(含 `dateType`)
|
|
266
|
+
- 若是通用报表 → 直接继承 `ReportBaseParam`(含 `page/startDate/endDate/exportCols`)
|
|
267
|
+
|
|
268
|
+
## 注意事项
|
|
269
|
+
|
|
270
|
+
- 报表Param类必须继承 `ReportBaseParam` 或其子类(如 `ReportAnalysisParam`)
|
|
271
|
+
- 时间字段使用 `LocalDate` 或 `LocalDateTime`
|
|
272
|
+
- `dateType` 字段含义:1=按月汇总,2=按日汇总
|
|
273
|
+
- 金额查询参数类型与业务域保持一致:钱包/账户用 `Long`(分),订单用 `BigDecimal`(分);见 leniu-java-amount-handling
|
|
274
|
+
- 导出时通过 `exportCols` 控制导出列
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
|
|
2
|
+
# leniu 标准版定制报表开发指南
|
|
3
|
+
|
|
4
|
+
> 详细字段说明见 `references/table-fields.md`,经营分析详情见 `references/analysis-module.md`
|
|
5
|
+
|
|
6
|
+
## 版本识别(必读)
|
|
7
|
+
|
|
8
|
+
**本 skill 仅适用于标准版(core-report 独立模块)**。
|
|
9
|
+
|
|
10
|
+
| 判断方式 | 标准版(本指南) | v5.29 版本 |
|
|
11
|
+
|---------|--------------|-----------|
|
|
12
|
+
| 目录结构 | `core-report/` 独立模块 | `sys-canteen/` 内嵌 |
|
|
13
|
+
| 退款存储 | 独立 `report_refund` 表(**正数**) | 合并入 `report_order_info`(`consumeType=2`,**负数**) |
|
|
14
|
+
| 第二阶段 | `fix()` 按日重算 | `batchConsume()` 增量累加 |
|
|
15
|
+
| consumeType | **无此字段** | 1=消费,2=退款 |
|
|
16
|
+
|
|
17
|
+
> v5.29 报表请使用 `leniu-report-customization`。钱包/交易类型枚举同 v5.29,参见该 skill。
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 二、核心基础表概要
|
|
21
|
+
|
|
22
|
+
### 2.1 report_order_info(仅存正向订单,无 consumeType)
|
|
23
|
+
|
|
24
|
+
关键字段:`orderId`(主键), `canteenId/stallId`, `mealtimeType`, `orderType`, `payableAmount/realAmount/refundAmount`(分), `accPayAmount/outPayAmount`, `payTime/orderDate`, `orderRefundState`(1未退/2全退/3部分退), `status`(0未消费/1已消费), `nuClearMode`, `psnType`, `ageType/holidayType`
|
|
25
|
+
|
|
26
|
+
### 2.2 report_order_detail(菜品明细)
|
|
27
|
+
|
|
28
|
+
关键字段:`detailId`, `orderId`, `goodsDishesId/goodsDishesName`, `price/totalAmount/realAmount`(分), `quantity`, `salesMode`(1按份/2称重), `detailState`(1正常/2全退/3部分退), `goodsRefundNum`, `refundAmount`, `detailType`
|
|
29
|
+
|
|
30
|
+
### 2.3 report_refund / report_refund_detail(标准版特有,退款为正数)
|
|
31
|
+
|
|
32
|
+
**report_refund**:`orderRefundId`(主键), `orderId`(原订单), `realRefundAmount`(**正数**), `applyType`(1退单/2纠错), `checkTime`
|
|
33
|
+
|
|
34
|
+
**report_refund_detail**:`orderRefundId`, `detailId`, `realQuantity`, `realRefundAmount`(**正数**)
|
|
35
|
+
|
|
36
|
+
### 2.4 其他基础表
|
|
37
|
+
|
|
38
|
+
- **report_order_pay**:`orderId`, `payType/payChannel`, `payAmount/refundAmount`
|
|
39
|
+
- **report_order_discount**:`orderId`, `changeAmount`, `changeType`(1上浮/2优惠), `changeDetailType`
|
|
40
|
+
- **report_order_info_snapshot**:订单交易快照
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## 四、账户流水报表
|
|
44
|
+
|
|
45
|
+
### 4.1 report_account_flow(流水主表)
|
|
46
|
+
|
|
47
|
+
核心字段:`flowId`, `custId/orgId`, `payTime`, `flowType`(AccTradeTypeEnum), `flowRealAmount/flowAmount`, `manageCost`, `accTotalBal/accAllBal`, `status`
|
|
48
|
+
|
|
49
|
+
### 4.2 report_account_summary(用户账户日结表)
|
|
50
|
+
|
|
51
|
+
联合主键:`statisticDate` + `custId`。期末余额 = 期初 + 充值 - 撤销充值 + 补贴 - 撤销补贴 + 红包 + 赠送 - 消费 - 补扣 + 退款 - 提现 - 清空 - 管理费
|
|
52
|
+
|
|
53
|
+
### 4.3 AccountConsumeService 实现
|
|
54
|
+
|
|
55
|
+
| ORDER | 类 | 汇总表 |
|
|
56
|
+
|-------|---|-------|
|
|
57
|
+
| 1/2 | Flow/FlowDetail | 基础表 |
|
|
58
|
+
| 13 | AccountSummary | 日结 |
|
|
59
|
+
| 14 | AccountOperator | 操作员 |
|
|
60
|
+
| 15-17 | ConsumeSummary/Org/Type | 消费维度 |
|
|
61
|
+
| 18 | WalletConsume | 钱包 |
|
|
62
|
+
| 19 | SumRechargeMer | 商户充值 |
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## 六、汇总模型速查
|
|
66
|
+
|
|
67
|
+
| 表 | 维度 | 金额 |
|
|
68
|
+
|----|------|------|
|
|
69
|
+
| report_sum_mealtime | date/canteen/stall/org/age/mealtime/psn/machine/source | custNum/consumeNum/realAmount/refundAmount |
|
|
70
|
+
| report_sum_pay | date/mealtime/canteen/stall/org/age/payChannel/payType | payNum/realAmount/refundAmount |
|
|
71
|
+
| report_sum_dishes | date/area/canteen/stall/reportOrderType/mealtime/cook/device/dishes/salesMode/detailType | quantity/realAmount |
|
|
72
|
+
| report_sum_pay_mer | tenantId/date/payChannel/payType | custNum/payNum/realAmount/refundAmount |
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## 八、公共模块
|
|
76
|
+
|
|
77
|
+
- **报表错误日志**(report_error_log):`reportErrorType`(1账户/2订单), `reportErrorState`(1已创建/2已处理)。定时任务 `@XxlJob("reportExceptionHandle")` 自动修复。
|
|
78
|
+
- **金额范围设置**:`POST /report/alloc/amount-scope/save`
|
|
79
|
+
- **数据修复**:`POST /summary/fix/order|account`(限31天,Redisson 锁 120 分钟)
|
|
80
|
+
|
|
81
|
+
### 核心枚举
|
|
82
|
+
|
|
83
|
+
| 枚举 | 值 |
|
|
84
|
+
|------|---|
|
|
85
|
+
| ReportClassifyEnum | 1组织/2类别/3食堂/4设备/5收入/6渠道/7餐次 |
|
|
86
|
+
| ReportPayTypeEnum | 1微信/2支付宝/3系统账户/9现金/20其他 |
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## 十、开发检查清单
|
|
90
|
+
|
|
91
|
+
### 建表
|
|
92
|
+
- [ ] 分组维度 + 金额汇总 + 审计字段(crby/crtime/upby/uptime/del_flag),无 tenant_id
|
|
93
|
+
|
|
94
|
+
### 实现
|
|
95
|
+
- [ ] 实现 `ReportOrderConsumeService`,设 `getOrder()`
|
|
96
|
+
- [ ] `fix()` 先删后插(**标准版核心模式**),`consume()` 留空
|
|
97
|
+
|
|
98
|
+
### 退款(标准版特有)
|
|
99
|
+
- [ ] 退款在独立 `report_refund` 表(**正数金额**)
|
|
100
|
+
- [ ] 净消费 = `real_amount - IFNULL(refund_amount, 0)`
|
|
101
|
+
- [ ] **不要使用 consumeType 字段**
|
|
102
|
+
|
|
103
|
+
### 查询
|
|
104
|
+
- [ ] ReportBaseTotalVO + CompletableFuture 并行 + MgrUserAuthPO 权限
|
|
105
|
+
- [ ] GROUP BY / ORDER BY 表达式与 SELECT 完全一致(only_full_group_by)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## 注意
|
|
109
|
+
|
|
110
|
+
- 标准版退款为独立表(正数金额),**不要使用 consumeType 字段**
|
|
111
|
+
- 标准版第二阶段用 `fix()` 按日重算,**不要使用 batchConsume() 增量模式**
|
|
112
|
+
- CRUD 用 `leniu-crud-development`,MyBatis 用 `leniu-java-mybatis`,入参用 `leniu-java-report-query-param`,合计行用 `leniu-java-total-line`,餐次用 `leniu-mealtime`
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 标准版报表基础表完整字段说明
|
|
2
|
+
|
|
3
|
+
## report_order_info(报表订单主表,仅正向订单)
|
|
4
|
+
|
|
5
|
+
> 标准版中此表**仅存正向订单**,退款数据在独立的 `report_refund` 表中。无 `consumeType` 字段。
|
|
6
|
+
|
|
7
|
+
| 字段 | 类型 | 说明 |
|
|
8
|
+
|------|------|------|
|
|
9
|
+
| `orderId` | Long | 主键(雪花 ID) |
|
|
10
|
+
| `machineSn` | String | 设备 SN |
|
|
11
|
+
| `orgId` | Long | 组织 ID |
|
|
12
|
+
| `custId` | Long | 人员 ID |
|
|
13
|
+
| `nuClearMode` | Integer | 核身方式(1刷卡/2刷脸/3扫码) |
|
|
14
|
+
| `sourceType` | Integer | 来源类型 |
|
|
15
|
+
| `ifOnline` | Integer | 是否在线(1是/2否) |
|
|
16
|
+
| `canteenId/canteenName` | Long/String | 食堂 |
|
|
17
|
+
| `stallId/stallName` | Long/String | 档口 |
|
|
18
|
+
| `mealtimeType` | Integer | 餐次(1早/2午/3下午茶/4晚/5夜宵) |
|
|
19
|
+
| `psnType` | Integer | 人员类别 |
|
|
20
|
+
| `payableAmount` | BigDecimal | 应付金额(分) |
|
|
21
|
+
| `discountsAmount` | BigDecimal | 优惠金额(分,取负数) |
|
|
22
|
+
| `deliveryAmount` | BigDecimal | 配送费(分) |
|
|
23
|
+
| `packingAmount` | BigDecimal | 包装费(分) |
|
|
24
|
+
| `realAmount` | BigDecimal | 实付金额(分) |
|
|
25
|
+
| `accPayAmount` | BigDecimal | 账户支付金额(分) |
|
|
26
|
+
| `outPayAmount` | BigDecimal | 外部支付金额(分) |
|
|
27
|
+
| `refundAmount` | BigDecimal | 累计退款金额(分) |
|
|
28
|
+
| `orderTime` | LocalDateTime | 下单时间 |
|
|
29
|
+
| `orderDate` | LocalDate | 就餐日期 |
|
|
30
|
+
| `orderType` | Integer | 订单类型(1当餐/2预订/3报餐/4扫码/5餐桌/6自助/11商城/12超市/21补扣/22外部) |
|
|
31
|
+
| `orderRefundState` | Integer | 退款状态(1未退/2已退/3部分退) |
|
|
32
|
+
| `payTime` | LocalDateTime | 支付时间 |
|
|
33
|
+
| `payType` | Integer | 支付方式 |
|
|
34
|
+
| `payChannel` | Integer | 支付渠道 |
|
|
35
|
+
| `ageType` | Integer | 年龄段 |
|
|
36
|
+
| `holidayType` | Integer | 节假日类型 |
|
|
37
|
+
| `status` | Integer | 消费状态(0未消费/1已消费) |
|
|
38
|
+
|
|
39
|
+
## report_order_detail(订单菜品明细表)
|
|
40
|
+
|
|
41
|
+
| 字段 | 类型 | 说明 |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| `detailId` | Long | 明细主键 |
|
|
44
|
+
| `orderId` | Long | 关联订单 ID |
|
|
45
|
+
| `goodsDishesId` | Long | 菜品 ID |
|
|
46
|
+
| `goodsDishesName` | String | 菜品名称 |
|
|
47
|
+
| `salePrice` | BigDecimal | 售卖价格(分) |
|
|
48
|
+
| `prefPrice` | BigDecimal | 优惠价格(分) |
|
|
49
|
+
| `price` | BigDecimal | 最终价格(分) |
|
|
50
|
+
| `weightUnit` | BigDecimal | 每份重量(g) |
|
|
51
|
+
| `quantity` | Integer | 数量/重量 |
|
|
52
|
+
| `salesMode` | Integer | 销售方式(1按份/2称重) |
|
|
53
|
+
| `detailType` | Integer | 类别(1菜品/2套餐/3商品/4按键/5补扣/6报餐) |
|
|
54
|
+
| `totalAmount` | BigDecimal | 总金额(分) |
|
|
55
|
+
| `realAmount` | BigDecimal | 实付金额(分) |
|
|
56
|
+
| `detailState` | Integer | 状态(1正常/2已退菜/3部分退菜) |
|
|
57
|
+
| `goodsRefundNum` | Integer | 已退数量 |
|
|
58
|
+
| `refundAmount` | BigDecimal | 退款金额(分) |
|
|
59
|
+
|
|
60
|
+
## report_refund(退款主表,标准版特有)
|
|
61
|
+
|
|
62
|
+
| 字段 | 类型 | 说明 |
|
|
63
|
+
|------|------|------|
|
|
64
|
+
| `orderRefundId` | Long | 退款单主键 |
|
|
65
|
+
| `orderId` | Long | 原始订单 ID |
|
|
66
|
+
| `realRefundAmount` | BigDecimal | 退款金额(**正数**) |
|
|
67
|
+
| `applyTime` | LocalDateTime | 申请时间 |
|
|
68
|
+
| `applyType` | Integer | 申请类型(1退单/2纠错) |
|
|
69
|
+
| `checkTime` | LocalDateTime | 审核时间 |
|
|
70
|
+
|
|
71
|
+
## report_refund_detail(退款明细表,标准版特有)
|
|
72
|
+
|
|
73
|
+
| 字段 | 类型 | 说明 |
|
|
74
|
+
|------|------|------|
|
|
75
|
+
| `orderRefundId` | Long | 退款单 ID |
|
|
76
|
+
| `detailId` | Long | 菜品详情 ID |
|
|
77
|
+
| `realQuantity` | Integer | 退单数量 |
|
|
78
|
+
| `realRefundAmount` | BigDecimal | 退款金额(**正数**) |
|
|
79
|
+
|
|
80
|
+
## report_account_flow(账户流水主表)
|
|
81
|
+
|
|
82
|
+
核心字段:`flowId`(主键), `custId`, `orgId`, `payTime`, `flowType`(AccTradeTypeEnum), `flowRealAmount`, `flowAmount`, `manageCost`, `accTotalBal`(可用余额), `accAllBal`(含冻结), `rechargeSource`, `payChannel/payType`, `status`(0未消费/1已消费)
|
|
83
|
+
|
|
84
|
+
附加字段:`rechargeOperate`(1单人/2批量/3导入/4赠送), `withdrawSource`(1小程序/2web/3openapi/4注销), `operateSource`(1手动清空/2批量/3定时/4注销)
|
|
85
|
+
|
|
86
|
+
## report_account_flow_detail(流水钱包明细)
|
|
87
|
+
|
|
88
|
+
字段:`flowId`, `walletId`(1个人/2补贴/4红包), `amount`(转出取负值), `walletBal`, `flowType`, `frozenBalance`, `allWalletBal`
|
|
89
|
+
|
|
90
|
+
## report_account_summary(用户账户日结表)
|
|
91
|
+
|
|
92
|
+
联合主键:`statisticDate` + `custId`
|
|
93
|
+
|
|
94
|
+
**期末余额公式**:
|
|
95
|
+
```
|
|
96
|
+
endAmount = beginAmount
|
|
97
|
+
+ rechargeAmount - rechargeRevokeAmount
|
|
98
|
+
+ subsidyAmount - subsidyRevokeAmount
|
|
99
|
+
+ luckAmount + giftAmount
|
|
100
|
+
- consumeAmount - consumeRepairAmount
|
|
101
|
+
+ consumeRefundAmount
|
|
102
|
+
- withdrawAmount - clearAmount - manageCostAmount
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
附加维度:充值渠道详分(微信/支付宝/现金/银行/第三方)、提现渠道详分、各钱包余额及冻结金额
|
|
106
|
+
|
|
107
|
+
## report_order_pay(订单支付表)
|
|
108
|
+
|
|
109
|
+
字段:`orderId`, `payType`, `payChannel`, `outTradeNo`, `payAmount`, `refundAmount`, `payableAmount`
|
|
110
|
+
|
|
111
|
+
## report_order_discount(订单优惠表)
|
|
112
|
+
|
|
113
|
+
字段:`orderId`, `changeAmount`, `changeType`(1上浮/2优惠), `changeDetailType`(1上浮/11菜品优惠/12打折/13累计减免/14固定减免)
|