Commit 84332e4
committed
fix: 代码审查问题修复与优化
## 高优先级修复
1. **导出功能完善** (reagent_orders.py)
- 导出CSV时查询并填充申请人姓名
2. **添加缓存机制** (reagent_orders.py)
- 新增 REAGENT_ORDER_CACHE 缓存查询结果
- 与 inventory.py 保持一致的缓存策略
3. **前后端验证统一**
- ReagentOrderCreate.price 改为必填 (gt=0)
- 前端 validationSchemas.ts price 使用 createPriceSchema(0.01)
- 删除前端无效的 supplier 字段
## 中等优先级修复
4. **创建通用用户查询函数** (user_utils.py)
- 新增 batch_get_user_names() 消除 N+1 查询
- reagent_orders.py、consumable_orders.py、inventory.py 统一使用
5. **规格验证正则修复** (spec_utils.py)
- 修复正则表达式避免匹配 "1.5.5" 等非法格式
6. **ConsumableOrder 字段统一**
- 改为 initial_quantity + unit 存储,与 ReagentOrder 一致
- 后端自动解析 specification 字符串
7. **前端 API 类型完善** (client.ts)
- 添加 ReagentOrderStatus、ConsumableOrderStatus 枚举
- status_filter 参数使用枚举类型1 parent 284b765 commit 84332e4
54 files changed
Lines changed: 29207 additions & 3231 deletions
File tree
- .claude
- .kilocode
- rules
- .sonar
- app
- api
- models
- services
- docs
- prompt
- frontend
- src
- api
- components
- ui
- lib
- pages
- plans
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
Whitespace-only changes.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
39 | 58 | | |
40 | 59 | | |
41 | 60 | | |
42 | 61 | | |
43 | 62 | | |
44 | 63 | | |
45 | 64 | | |
46 | | - | |
| 65 | + | |
| 66 | + | |
47 | 67 | | |
48 | 68 | | |
49 | 69 | | |
| |||
111 | 131 | | |
112 | 132 | | |
113 | 133 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 134 | + | |
119 | 135 | | |
120 | 136 | | |
121 | 137 | | |
122 | | - | |
| 138 | + | |
123 | 139 | | |
124 | 140 | | |
125 | 141 | | |
| |||
287 | 303 | | |
288 | 304 | | |
289 | 305 | | |
290 | | - | |
| 306 | + | |
291 | 307 | | |
292 | 308 | | |
293 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 229 | + | |
236 | 230 | | |
237 | 231 | | |
238 | 232 | | |
| |||
602 | 596 | | |
603 | 597 | | |
604 | 598 | | |
605 | | - | |
| 599 | + | |
606 | 600 | | |
607 | 601 | | |
608 | 602 | | |
| |||
617 | 611 | | |
618 | 612 | | |
619 | 613 | | |
620 | | - | |
621 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
622 | 621 | | |
623 | 622 | | |
624 | 623 | | |
| |||
775 | 774 | | |
776 | 775 | | |
777 | 776 | | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
| 777 | + | |
| 778 | + | |
784 | 779 | | |
785 | 780 | | |
786 | 781 | | |
| |||
804 | 799 | | |
805 | 800 | | |
806 | 801 | | |
807 | | - | |
808 | | - | |
| 802 | + | |
| 803 | + | |
809 | 804 | | |
810 | 805 | | |
811 | 806 | | |
| |||
0 commit comments