@newpeak/barista-cli 0.1.7 → 0.1.8
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/dist/commands/liberica/calendar/index.d.ts +3 -0
- package/dist/commands/liberica/calendar/index.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/index.js +11 -0
- package/dist/commands/liberica/calendar/index.js.map +1 -0
- package/dist/commands/liberica/calendar/list.d.ts +3 -0
- package/dist/commands/liberica/calendar/list.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/list.js +181 -0
- package/dist/commands/liberica/calendar/list.js.map +1 -0
- package/dist/commands/liberica/calendar/set.d.ts +3 -0
- package/dist/commands/liberica/calendar/set.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/set.js +120 -0
- package/dist/commands/liberica/calendar/set.js.map +1 -0
- package/dist/commands/liberica/client-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/create.js +132 -0
- package/dist/commands/liberica/client-contacts/create.js.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.js +139 -0
- package/dist/commands/liberica/client-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/client-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/get.js +92 -0
- package/dist/commands/liberica/client-contacts/get.js.map +1 -0
- package/dist/commands/liberica/client-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/index.js +17 -0
- package/dist/commands/liberica/client-contacts/index.js.map +1 -0
- package/dist/commands/liberica/client-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/list.js +92 -0
- package/dist/commands/liberica/client-contacts/list.js.map +1 -0
- package/dist/commands/liberica/client-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/update.js +156 -0
- package/dist/commands/liberica/client-contacts/update.js.map +1 -0
- package/dist/commands/liberica/dict-types/get.d.ts +3 -0
- package/dist/commands/liberica/dict-types/get.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/get.js +62 -0
- package/dist/commands/liberica/dict-types/get.js.map +1 -0
- package/dist/commands/liberica/dict-types/index.d.ts +3 -0
- package/dist/commands/liberica/dict-types/index.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/index.js +13 -0
- package/dist/commands/liberica/dict-types/index.js.map +1 -0
- package/dist/commands/liberica/dict-types/list.d.ts +3 -0
- package/dist/commands/liberica/dict-types/list.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/list.js +91 -0
- package/dist/commands/liberica/dict-types/list.js.map +1 -0
- package/dist/commands/liberica/dict-types/update.d.ts +3 -0
- package/dist/commands/liberica/dict-types/update.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/update.js +127 -0
- package/dist/commands/liberica/dict-types/update.js.map +1 -0
- package/dist/commands/liberica/dicts/create.d.ts +3 -0
- package/dist/commands/liberica/dicts/create.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/create.js +157 -0
- package/dist/commands/liberica/dicts/create.js.map +1 -0
- package/dist/commands/liberica/dicts/delete.d.ts +3 -0
- package/dist/commands/liberica/dicts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/delete.js +106 -0
- package/dist/commands/liberica/dicts/delete.js.map +1 -0
- package/dist/commands/liberica/dicts/get.d.ts +3 -0
- package/dist/commands/liberica/dicts/get.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/get.js +69 -0
- package/dist/commands/liberica/dicts/get.js.map +1 -0
- package/dist/commands/liberica/dicts/index.d.ts +3 -0
- package/dist/commands/liberica/dicts/index.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/index.js +17 -0
- package/dist/commands/liberica/dicts/index.js.map +1 -0
- package/dist/commands/liberica/dicts/list.d.ts +3 -0
- package/dist/commands/liberica/dicts/list.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/list.js +88 -0
- package/dist/commands/liberica/dicts/list.js.map +1 -0
- package/dist/commands/liberica/dicts/update.d.ts +3 -0
- package/dist/commands/liberica/dicts/update.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/update.js +112 -0
- package/dist/commands/liberica/dicts/update.js.map +1 -0
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +18 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/operations/active.d.ts +3 -0
- package/dist/commands/liberica/operations/active.d.ts.map +1 -0
- package/dist/commands/liberica/operations/active.js +152 -0
- package/dist/commands/liberica/operations/active.js.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.js +130 -0
- package/dist/commands/liberica/operations/batch-delete.js.map +1 -0
- package/dist/commands/liberica/operations/copy.d.ts +3 -0
- package/dist/commands/liberica/operations/copy.d.ts.map +1 -0
- package/dist/commands/liberica/operations/copy.js +137 -0
- package/dist/commands/liberica/operations/copy.js.map +1 -0
- package/dist/commands/liberica/operations/create.d.ts +3 -0
- package/dist/commands/liberica/operations/create.d.ts.map +1 -0
- package/dist/commands/liberica/operations/create.js +212 -0
- package/dist/commands/liberica/operations/create.js.map +1 -0
- package/dist/commands/liberica/operations/deactive.d.ts +3 -0
- package/dist/commands/liberica/operations/deactive.d.ts.map +1 -0
- package/dist/commands/liberica/operations/deactive.js +152 -0
- package/dist/commands/liberica/operations/deactive.js.map +1 -0
- package/dist/commands/liberica/operations/delete.d.ts +3 -0
- package/dist/commands/liberica/operations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/delete.js +128 -0
- package/dist/commands/liberica/operations/delete.js.map +1 -0
- package/dist/commands/liberica/operations/get.d.ts +3 -0
- package/dist/commands/liberica/operations/get.d.ts.map +1 -0
- package/dist/commands/liberica/operations/get.js +93 -0
- package/dist/commands/liberica/operations/get.js.map +1 -0
- package/dist/commands/liberica/operations/index.d.ts +3 -0
- package/dist/commands/liberica/operations/index.d.ts.map +1 -0
- package/dist/commands/liberica/operations/index.js +25 -0
- package/dist/commands/liberica/operations/index.js.map +1 -0
- package/dist/commands/liberica/operations/list.d.ts +3 -0
- package/dist/commands/liberica/operations/list.d.ts.map +1 -0
- package/dist/commands/liberica/operations/list.js +141 -0
- package/dist/commands/liberica/operations/list.js.map +1 -0
- package/dist/commands/liberica/operations/update.d.ts +3 -0
- package/dist/commands/liberica/operations/update.d.ts.map +1 -0
- package/dist/commands/liberica/operations/update.js +208 -0
- package/dist/commands/liberica/operations/update.js.map +1 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js +41 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js +39 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js.map +1 -0
- package/dist/commands/liberica/stock/index.d.ts +3 -0
- package/dist/commands/liberica/stock/index.d.ts.map +1 -0
- package/dist/commands/liberica/stock/index.js +11 -0
- package/dist/commands/liberica/stock/index.js.map +1 -0
- package/dist/commands/liberica/stock/ledger.d.ts +3 -0
- package/dist/commands/liberica/stock/ledger.d.ts.map +1 -0
- package/dist/commands/liberica/stock/ledger.js +154 -0
- package/dist/commands/liberica/stock/ledger.js.map +1 -0
- package/dist/commands/liberica/stock/list.d.ts +3 -0
- package/dist/commands/liberica/stock/list.d.ts.map +1 -0
- package/dist/commands/liberica/stock/list.js +127 -0
- package/dist/commands/liberica/stock/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.js +129 -0
- package/dist/commands/liberica/supplier-contacts/create.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.js +88 -0
- package/dist/commands/liberica/supplier-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.js +84 -0
- package/dist/commands/liberica/supplier-contacts/get.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.js +17 -0
- package/dist/commands/liberica/supplier-contacts/index.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.js +98 -0
- package/dist/commands/liberica/supplier-contacts/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.js +136 -0
- package/dist/commands/liberica/supplier-contacts/update.js.map +1 -0
- package/dist/core/api/client.d.ts +46 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +865 -52
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/calendar.d.ts +28 -0
- package/dist/types/calendar.d.ts.map +1 -0
- package/dist/types/calendar.js +2 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/client-contact.d.ts +65 -0
- package/dist/types/client-contact.d.ts.map +1 -0
- package/dist/types/client-contact.js +4 -0
- package/dist/types/client-contact.js.map +1 -0
- package/dist/types/dict.d.ts +97 -0
- package/dist/types/dict.d.ts.map +1 -0
- package/dist/types/dict.js +2 -0
- package/dist/types/dict.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/operation.d.ts +66 -0
- package/dist/types/operation.d.ts.map +1 -0
- package/dist/types/operation.js +2 -0
- package/dist/types/operation.js.map +1 -0
- package/dist/types/stock.d.ts +133 -0
- package/dist/types/stock.d.ts.map +1 -0
- package/dist/types/stock.js +3 -0
- package/dist/types/stock.js.map +1 -0
- package/dist/types/supplier-contact.d.ts +65 -0
- package/dist/types/supplier-contact.d.ts.map +1 -0
- package/dist/types/supplier-contact.js +4 -0
- package/dist/types/supplier-contact.js.map +1 -0
- package/docs/commands/REFERENCE.md +24 -4
- package/docs/commands/liberica/calendar/DESIGN.md +333 -0
- package/docs/commands/liberica/client-contacts/create.md +152 -0
- package/docs/commands/liberica/client-contacts/delete.md +123 -0
- package/docs/commands/liberica/client-contacts/get.md +133 -0
- package/docs/commands/liberica/client-contacts/list.md +143 -0
- package/docs/commands/liberica/client-contacts/update.md +158 -0
- package/docs/commands/liberica/stock/ledger.md +209 -0
- package/docs/commands/liberica/stock/list.md +165 -0
- package/docs/commands/liberica/supplier-contacts/create.md +152 -0
- package/docs/commands/liberica/supplier-contacts/delete.md +123 -0
- package/docs/commands/liberica/supplier-contacts/get.md +133 -0
- package/docs/commands/liberica/supplier-contacts/list.md +143 -0
- package/docs/commands/liberica/supplier-contacts/update.md +158 -0
- package/package.json +1 -1
- package/src/commands/liberica/calendar/index.ts +13 -0
- package/src/commands/liberica/calendar/list.ts +214 -0
- package/src/commands/liberica/calendar/set.ts +130 -0
- package/src/commands/liberica/client-contacts/create.ts +115 -0
- package/src/commands/liberica/client-contacts/delete.ts +140 -0
- package/src/commands/liberica/client-contacts/get.ts +103 -0
- package/src/commands/liberica/client-contacts/index.ts +19 -0
- package/src/commands/liberica/client-contacts/list.ts +118 -0
- package/src/commands/liberica/client-contacts/update.ts +137 -0
- package/src/commands/liberica/dict-types/get.ts +74 -0
- package/src/commands/liberica/dict-types/index.ts +15 -0
- package/src/commands/liberica/dict-types/list.ts +118 -0
- package/src/commands/liberica/dict-types/update.ts +134 -0
- package/src/commands/liberica/dicts/create.ts +175 -0
- package/src/commands/liberica/dicts/delete.ts +107 -0
- package/src/commands/liberica/dicts/get.ts +80 -0
- package/src/commands/liberica/dicts/index.ts +19 -0
- package/src/commands/liberica/dicts/list.ts +114 -0
- package/src/commands/liberica/dicts/update.ts +116 -0
- package/src/commands/liberica/index.ts +18 -0
- package/src/commands/liberica/operations/active.ts +153 -0
- package/src/commands/liberica/operations/batch-delete.ts +131 -0
- package/src/commands/liberica/operations/copy.ts +138 -0
- package/src/commands/liberica/operations/create.ts +223 -0
- package/src/commands/liberica/operations/deactive.ts +152 -0
- package/src/commands/liberica/operations/delete.ts +128 -0
- package/src/commands/liberica/operations/design.md +587 -0
- package/src/commands/liberica/operations/get.ts +112 -0
- package/src/commands/liberica/operations/index.ts +27 -0
- package/src/commands/liberica/operations/list.ts +180 -0
- package/src/commands/liberica/operations/update.ts +218 -0
- package/src/commands/liberica/stock/index.ts +13 -0
- package/src/commands/liberica/stock/ledger.ts +159 -0
- package/src/commands/liberica/stock/list.ts +128 -0
- package/src/commands/liberica/supplier-contacts/create.ts +120 -0
- package/src/commands/liberica/supplier-contacts/delete.ts +88 -0
- package/src/commands/liberica/supplier-contacts/get.ts +94 -0
- package/src/commands/liberica/supplier-contacts/index.ts +19 -0
- package/src/commands/liberica/supplier-contacts/list.ts +130 -0
- package/src/commands/liberica/supplier-contacts/update.ts +127 -0
- package/src/core/api/client.ts +1093 -74
- package/src/index.ts +1 -1
- package/src/types/calendar.ts +36 -0
- package/src/types/client-contact.ts +78 -0
- package/src/types/dict.ts +121 -0
- package/src/types/index.ts +5 -0
- package/src/types/operation.ts +72 -0
- package/src/types/stock.ts +161 -0
- package/src/types/supplier-contact.ts +78 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# barista liberica calendar
|
|
2
|
+
|
|
3
|
+
工作日历管理命令组。支持查询租户工作日历列表和设置指定日期的日历类型。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 2.1 命令元数据
|
|
8
|
+
|
|
9
|
+
### calendar list
|
|
10
|
+
|
|
11
|
+
| 字段 | 值 |
|
|
12
|
+
|------|-----|
|
|
13
|
+
| 完整命令 | `barista liberica calendar list` |
|
|
14
|
+
| 功能描述 | 查询租户工作日历列表 |
|
|
15
|
+
| HTTP方法 | GET |
|
|
16
|
+
| 是否需要认证 | ✅ 是 |
|
|
17
|
+
| 是否支持dry-run | ⬜ 否 |
|
|
18
|
+
|
|
19
|
+
### calendar set
|
|
20
|
+
|
|
21
|
+
| 字段 | 值 |
|
|
22
|
+
|------|-----|
|
|
23
|
+
| 完整命令 | `barista liberica calendar set` |
|
|
24
|
+
| 功能描述 | 设置指定日期的日历类型 |
|
|
25
|
+
| HTTP方法 | POST |
|
|
26
|
+
| 是否需要认证 | ✅ 是 |
|
|
27
|
+
| 是否支持dry-run | ✅ 是 |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2.2 后端接口引用
|
|
32
|
+
|
|
33
|
+
### Controller位置
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
coffee-liberica-end/
|
|
37
|
+
└── facade/liberica-facade-enterprise/
|
|
38
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/
|
|
39
|
+
└── EnterpriseCalendarController.java
|
|
40
|
+
└── page(@GetResource(path = "/page"))
|
|
41
|
+
└── public ResponseData<Map<String, List<WorkDayCalendar>>> page(
|
|
42
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
43
|
+
@ParameterObject WorkCalendarRequest request
|
|
44
|
+
)
|
|
45
|
+
└── edit(@PostResource(path = "/edit", requiredPermission = true, requirePermissionCode = "EDIT_CALENDAR"))
|
|
46
|
+
└── public ResponseData<?> edit(
|
|
47
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
48
|
+
@RequestBody TenantCalendarRequest request
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Request DTO位置
|
|
53
|
+
|
|
54
|
+
**WorkCalendarRequest(列表查询)**
|
|
55
|
+
```
|
|
56
|
+
coffee-liberica-end/
|
|
57
|
+
└── support/support-t-calendar/data-calendar-business/
|
|
58
|
+
└── src/main/java/com/newpeak/liberica/business/support/calendar/pojo/request/
|
|
59
|
+
└── WorkCalendarRequest.java
|
|
60
|
+
├── year: Integer
|
|
61
|
+
├── month: Integer
|
|
62
|
+
├── months: Integer
|
|
63
|
+
└── entityCode: String
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**TenantCalendarRequest(编辑日历类型)**
|
|
67
|
+
```
|
|
68
|
+
coffee-liberica-end/
|
|
69
|
+
└── support/support-t-calendar/data-calendar-business/
|
|
70
|
+
└── src/main/java/com/newpeak/liberica/business/support/calendar/pojo/request/
|
|
71
|
+
└── TenantCalendarRequest.java
|
|
72
|
+
├── tenantId: Long
|
|
73
|
+
├── countryCode: String
|
|
74
|
+
├── calendarDate: String (@NotBlank)
|
|
75
|
+
├── dateType: DateType (@NotBlank)
|
|
76
|
+
├── remark: String
|
|
77
|
+
└── versionFlag: Long
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Response DTO位置
|
|
81
|
+
|
|
82
|
+
**WorkDayCalendar(列表响应元素)**
|
|
83
|
+
```
|
|
84
|
+
coffee-liberica-end/
|
|
85
|
+
└── support/support-t-calendar/data-calendar-api/
|
|
86
|
+
└── src/main/java/com/newpeak/liberica/support/calendar/api/
|
|
87
|
+
└── WorkDayCalendar.java (interface)
|
|
88
|
+
├── getCalendarDate(): String
|
|
89
|
+
├── getRemark(): String
|
|
90
|
+
├── getDateType(): DateType
|
|
91
|
+
├── isWorkDay(): boolean
|
|
92
|
+
├── isNonWorkDay(): boolean
|
|
93
|
+
└── isWeekend(): boolean
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**DateType枚举**
|
|
97
|
+
```
|
|
98
|
+
coffee-liberica-end/
|
|
99
|
+
└── support/support-t-calendar/data-calendar-api/
|
|
100
|
+
└── src/main/java/com/newpeak/liberica/support/calendar/api/
|
|
101
|
+
└── DateType.java
|
|
102
|
+
├── WORKDAY
|
|
103
|
+
├── WEEKEND
|
|
104
|
+
└── HOLIDAY
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 2.3 CLI参数设计
|
|
110
|
+
|
|
111
|
+
### 命令结构
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
barista liberica calendar <subcommand> [options]
|
|
115
|
+
|
|
116
|
+
# Subcommands
|
|
117
|
+
barista liberica calendar list [options]
|
|
118
|
+
barista liberica calendar set [options]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 全局选项
|
|
122
|
+
|
|
123
|
+
| 选项 | 类型 | 说明 |
|
|
124
|
+
|------|------|------|
|
|
125
|
+
| `--env` | string | 目标环境(dev\|test\|prod-cn\|prod-jp) |
|
|
126
|
+
| `--tenant` | string | 租户代码(仅Liberica) |
|
|
127
|
+
| `--dry-run` | boolean | 预览模式 |
|
|
128
|
+
| `--json` | boolean | JSON输出 |
|
|
129
|
+
|
|
130
|
+
### calendar list 命令选项
|
|
131
|
+
|
|
132
|
+
| 选项 | 短选项 | 类型 | 必填 | 默认值 | 说明 | 对应DTO字段 |
|
|
133
|
+
|------|--------|------|------|--------|------|-------------|
|
|
134
|
+
| --year | -y | number | ✅ | - | 年份 | year |
|
|
135
|
+
| --month | -m | number | ✅ | - | 月份 (1-12) | month |
|
|
136
|
+
| --months | — | number | ⬜ | 12 | 查询月数 | months |
|
|
137
|
+
| --grid | -g | boolean | ⬜ | false | 日历网格视图 | - |
|
|
138
|
+
| --json | — | boolean | ⬜ | false | JSON输出 | - |
|
|
139
|
+
|
|
140
|
+
### calendar set 命令选项
|
|
141
|
+
|
|
142
|
+
| 选项 | 短选项 | 类型 | 必填 | 默认值 | 说明 | 对应DTO字段 |
|
|
143
|
+
|------|--------|------|------|--------|------|-------------|
|
|
144
|
+
| --date | -d | string | ✅ | - | 日期 (yyyy-MM-dd) | calendarDate |
|
|
145
|
+
| --type | -t | string | ✅ | - | 日期类型 (WORKDAY\|WEEKEND\|HOLIDAY) | dateType |
|
|
146
|
+
| --remark | -r | string | ⬜ | - | 备注说明 | remark |
|
|
147
|
+
| --dry-run | — | boolean | ⬜ | false | 预览模式 | - |
|
|
148
|
+
| --json | — | boolean | ⬜ | false | JSON输出 | - |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 2.4 字段映射表
|
|
153
|
+
|
|
154
|
+
### calendar list
|
|
155
|
+
|
|
156
|
+
| CLI参数 | DTO字段 | 类型转换 | 验证规则 |
|
|
157
|
+
|---------|---------|----------|----------|
|
|
158
|
+
| --year / -y | year | number→Integer | 4位数字,>= 2000 |
|
|
159
|
+
| --month / -m | month | number→Integer | 1-12 |
|
|
160
|
+
| --months | months | number→Integer | >= 1,默认12 |
|
|
161
|
+
|
|
162
|
+
### calendar set
|
|
163
|
+
|
|
164
|
+
| CLI参数 | DTO字段 | 类型转换 | 验证规则 |
|
|
165
|
+
|---------|---------|----------|----------|
|
|
166
|
+
| --date / -d | calendarDate | 直接传递 | yyyy-MM-dd,@NotBlank |
|
|
167
|
+
| --type / -t | dateType | 直接传递 | 枚举值 WORKDAY/WEEKEND/HOLIDAY,@NotBlank |
|
|
168
|
+
| --remark / -r | remark | 直接传递 | 可选,max=255 |
|
|
169
|
+
|
|
170
|
+
**自动填充字段(不通过CLI参数):**
|
|
171
|
+
|
|
172
|
+
| 字段 | 值 |
|
|
173
|
+
|------|-----|
|
|
174
|
+
| tenantId | 由后端从JWT Token中解析,CLI不传递 X-TENANT-ID header |
|
|
175
|
+
| countryCode | 后端根据tenantId查询Tenant表自动填充 |
|
|
176
|
+
| versionFlag | 编辑时由后端查询现有记录自动填充(upsert逻辑) |
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 2.5 错误码引用
|
|
181
|
+
|
|
182
|
+
### ExceptionEnum位置
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
coffee-liberica-end/
|
|
186
|
+
└── support/support-t-calendar/data-calendar-business/
|
|
187
|
+
└── src/main/java/com/newpeak/liberica/business/support/calendar/enums/
|
|
188
|
+
├── CalendarExceptionEnum.java
|
|
189
|
+
│ └── CALENDAR_NOT_EXISTED("01001100001", "查询结果不存在")
|
|
190
|
+
└── TenantCalendarExceptionEnum.java
|
|
191
|
+
└── TENANT_CALENDAR_NOT_EXISTED("01001100001", "查询结果不存在")
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 已知错误码
|
|
195
|
+
|
|
196
|
+
| 错误码 | 错误消息 | 触发条件 |
|
|
197
|
+
|--------|----------|----------|
|
|
198
|
+
| 01001100001 | 查询结果不存在 | 查询无匹配结果(通常返回空列表或空Map) |
|
|
199
|
+
|
|
200
|
+
### Service层业务校验
|
|
201
|
+
|
|
202
|
+
`EnterpriseCalendarController.edit()` 内部采用 upsert 逻辑:
|
|
203
|
+
1. 根据 `tenantId + calendarDate` 查询现有记录
|
|
204
|
+
2. 若记录不存在,调用 `tenantCalendarBusiness.add(request)` 新增
|
|
205
|
+
3. 若记录存在,设置 `tenantCalendarId` 后调用 `tenantCalendarBusiness.edit(request)` 更新
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 2.6 权限检查
|
|
210
|
+
|
|
211
|
+
| 检查项 | 位置 | 说明 |
|
|
212
|
+
|--------|------|------|
|
|
213
|
+
| `calendar list` | `@GetResource(path = "/page")` | 无 requiredPermission(无需权限码) |
|
|
214
|
+
| `calendar set` | `@PostResource(path = "/edit", requiredPermission = true, requirePermissionCode = "EDIT_CALENDAR")` | 需要 EDIT_CALENDAR 权限 |
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 2.7 实现要点
|
|
219
|
+
|
|
220
|
+
### 通用约定
|
|
221
|
+
|
|
222
|
+
1. **无 X-TENANT-ID Header**:CLI 规范禁止传递此 Header,租户信息通过 JWT Token 由后端解析。
|
|
223
|
+
2. **ID 类型**:所有 ID 字段使用 `string` 类型(避免后端 BigInteger 精度丢失)。
|
|
224
|
+
3. **错误响应归一化**:后端存在两种错误格式,需在 `handleApiError()` 中统一处理:
|
|
225
|
+
- 格式1: `{ success: false, code: "A150001", message: "..." }`
|
|
226
|
+
- 格式2: `{ success: false, error: { code: "...", message: "..." } }`
|
|
227
|
+
|
|
228
|
+
### calendar list 实现要点
|
|
229
|
+
|
|
230
|
+
1. **参数验证**:`--year` 和 `--month` 为必填项;`--months` 默认值为 12。
|
|
231
|
+
2. **API 路径**:`GET /api/enterprise/portal/calendar/page`
|
|
232
|
+
3. **响应结构**:返回 `Map<String, List<WorkDayCalendar>>`,Key 为日期字符串(如 `"2025-04"`),Value 为该月份每日的日历对象列表。
|
|
233
|
+
4. **输出模式**:
|
|
234
|
+
- 默认输出:按月份分组表格,显示日期、类型、备注
|
|
235
|
+
- `--grid` 模式:日历网格视图,每行一周,标注工作日/周末/假日
|
|
236
|
+
- `--json` 模式:结构化 JSON 输出
|
|
237
|
+
|
|
238
|
+
### calendar set 实现要点
|
|
239
|
+
|
|
240
|
+
1. **参数验证**:`--date` 格式必须为 `yyyy-MM-dd`;`--type` 必须为 `WORKDAY|WEEKEND|HOLIDAY` 之一。
|
|
241
|
+
2. **API 路径**:`POST /api/enterprise/portal/calendar/edit`
|
|
242
|
+
3. **Dry-run 支持**:使用 `--dry-run` 时构造 `TenantCalendarRequest` 但不发送请求,输出预览信息(日期、目标类型、备注)。
|
|
243
|
+
4. **Upsert 行为**:后端自动判断是新增还是更新同一日期的记录。
|
|
244
|
+
5. **成功响应**:`SuccessResponseData<>` 无具体 data 内容,输出成功提示即可。
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 2.8 测试策略(TDD)
|
|
249
|
+
|
|
250
|
+
### 单元测试文件位置
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
coffee-barista-cli/
|
|
254
|
+
└── tests/unit/commands/liberica/calendar/
|
|
255
|
+
├── list.test.ts
|
|
256
|
+
└── set.test.ts
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### calendar list 测试场景
|
|
260
|
+
|
|
261
|
+
- [ ] 正常查询:提供 `--year` 和 `--month`,返回多月份日历数据
|
|
262
|
+
- [ ] 默认 `--months=12`:未传该参数时验证 API 请求参数
|
|
263
|
+
- [ ] 自定义 `--months`:验证请求参数正确传递
|
|
264
|
+
- [ ] `--grid` 视图:验证表格按周排列输出
|
|
265
|
+
- [ ] `--json` 输出:验证 JSON 结构包含 `success` 和 `data`
|
|
266
|
+
- [ ] 缺少必填参数:`--year` 或 `--month` 缺失时返回验证错误
|
|
267
|
+
- [ ] 无效参数:`--month 13` 返回验证错误
|
|
268
|
+
- [ ] 空结果:API 返回空 Map 时友好提示
|
|
269
|
+
- [ ] 错误响应:模拟后端两种错误格式,验证统一处理
|
|
270
|
+
|
|
271
|
+
### calendar set 测试场景
|
|
272
|
+
|
|
273
|
+
- [ ] 正常设置:`--date` 和 `--type` 均有效,API 调用成功
|
|
274
|
+
- [ ] 带备注设置:`--remark` 参数正确传递
|
|
275
|
+
- [ ] `--dry-run` 模式:不调用 API,输出预览信息
|
|
276
|
+
- [ ] `--json` 输出:dry-run 和正常模式均验证 JSON 结构
|
|
277
|
+
- [ ] 缺少必填参数:`--date` 或 `--type` 缺失时返回验证错误
|
|
278
|
+
- [ ] 无效日期格式:`--date 2025/04/15` 返回验证错误
|
|
279
|
+
- [ ] 无效类型值:`--type INVALID` 返回验证错误
|
|
280
|
+
- [ ] 错误响应:模拟无权限/后端异常,验证友好提示和退出码
|
|
281
|
+
|
|
282
|
+
### 集成测试流程
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# 1. 登录
|
|
286
|
+
barista liberica auth login dev shanghai admin@shanghai.newpeaksh.com 123456
|
|
287
|
+
|
|
288
|
+
# 2. 查询 2025 年 4 月日历
|
|
289
|
+
barista liberica calendar list --year 2025 --month 4
|
|
290
|
+
|
|
291
|
+
# 3. 查询 2025 年 4 月起连续 3 个月
|
|
292
|
+
barista liberica calendar list --year 2025 --month 4 --months 3
|
|
293
|
+
|
|
294
|
+
# 4. 网格视图
|
|
295
|
+
barista liberica calendar list --year 2025 --month 4 --grid
|
|
296
|
+
|
|
297
|
+
# 5. JSON 输出
|
|
298
|
+
barista liberica calendar list --year 2025 --month 4 --json
|
|
299
|
+
|
|
300
|
+
# 6. 设置日期类型(dry-run)
|
|
301
|
+
barista liberica calendar set --date 2025-04-15 --type HOLIDAY --remark "测试假日" --dry-run
|
|
302
|
+
|
|
303
|
+
# 7. 实际设置日期类型
|
|
304
|
+
barista liberica calendar set --date 2025-04-15 --type HOLIDAY --remark "测试假日"
|
|
305
|
+
|
|
306
|
+
# 8. 验证设置结果
|
|
307
|
+
barista liberica calendar list --year 2025 --month 4 --json
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 2.9 示例用法
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# 查询 2025 年全年工作日历
|
|
316
|
+
barista liberica calendar list --year 2025 --month 1
|
|
317
|
+
|
|
318
|
+
# 查询 2025 年第二季度(4-6月)
|
|
319
|
+
barista liberica calendar list --year 2025 --month 4 --months 3
|
|
320
|
+
|
|
321
|
+
# 网格视图展示
|
|
322
|
+
barista liberica calendar list -y 2025 -m 4 --grid
|
|
323
|
+
|
|
324
|
+
# 设置 2025-04-15 为假日
|
|
325
|
+
barista liberica calendar set --date 2025-04-15 --type HOLIDAY --remark "清明节调休"
|
|
326
|
+
|
|
327
|
+
# 预览设置(不实际提交)
|
|
328
|
+
barista liberica calendar set -d 2025-04-15 -t HOLIDAY -r "测试" --dry-run
|
|
329
|
+
|
|
330
|
+
# JSON 输出(便于脚本处理)
|
|
331
|
+
barista liberica calendar list --year 2025 --month 4 --json
|
|
332
|
+
barista liberica calendar set --date 2025-04-15 --type WORKDAY --json
|
|
333
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# barista liberica client-contacts create
|
|
2
|
+
|
|
3
|
+
创建客户联系人。
|
|
4
|
+
|
|
5
|
+
## 2.1 命令元数据
|
|
6
|
+
|
|
7
|
+
| 字段 | 值 |
|
|
8
|
+
|------|-----|
|
|
9
|
+
| 完整命令 | `barista liberica client-contacts create` |
|
|
10
|
+
| 功能描述 | 添加新客户联系人 |
|
|
11
|
+
| HTTP方法 | POST |
|
|
12
|
+
| 是否需要认证 | ✅ 是 |
|
|
13
|
+
| 是否支持dry-run | ✅ 是 |
|
|
14
|
+
|
|
15
|
+
## 2.2 后端接口引用
|
|
16
|
+
|
|
17
|
+
### Controller位置
|
|
18
|
+
```
|
|
19
|
+
coffee-liberica-end/
|
|
20
|
+
└── facade/liberica-facade-enterprise/
|
|
21
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/sales/
|
|
22
|
+
└── EnterpriseClientContactController.java
|
|
23
|
+
└── add(@PostResource(path = "/add", requiredPermission = true, requirePermissionCode = "ADD_MASTER_CLIENT_CONTACT"))
|
|
24
|
+
└── public ResponseData<MasterClientContactResponse> add(
|
|
25
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
26
|
+
@RequestBody @Validated(BaseRequest.add.class) MasterClientContactRequest masterClientContactRequest
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Request DTO位置
|
|
31
|
+
```
|
|
32
|
+
coffee-liberica-end/
|
|
33
|
+
└── business/liberica-business-sales/sales-api/
|
|
34
|
+
└── src/main/java/com/newpeak/liberica/sales/api/pojo/request/
|
|
35
|
+
└── MasterClientContactRequest.java
|
|
36
|
+
├── clientId: Long (@NotNull)
|
|
37
|
+
├── clientContactName: String (@NotBlank, max=255)
|
|
38
|
+
├── clientContactPhone: String (max=256)
|
|
39
|
+
├── clientContactTelephone: String (max=256)
|
|
40
|
+
├── clientContactEmail: String (max=512)
|
|
41
|
+
├── clientContactSex: String (max=255)
|
|
42
|
+
├── clientContactBirthday: Date
|
|
43
|
+
├── clientContactQq: String (max=512)
|
|
44
|
+
├── clientContactWechat: String (max=512)
|
|
45
|
+
├── clientContactAddress: String (max=512)
|
|
46
|
+
├── defaultFlag: String (@NotBlank, max=1)
|
|
47
|
+
└── remark: String (max=255)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Response DTO位置
|
|
51
|
+
```
|
|
52
|
+
coffee-liberica-end/
|
|
53
|
+
└── business/liberica-business-sales/sales-api/
|
|
54
|
+
└── src/main/java/com/newpeak/liberica/sales/api/pojo/response/
|
|
55
|
+
└── MasterClientContactResponse.java
|
|
56
|
+
└── (同 get 接口)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 2.3 CLI参数设计
|
|
60
|
+
|
|
61
|
+
### 命令结构
|
|
62
|
+
```
|
|
63
|
+
barista liberica client-contacts create [options]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 全局选项
|
|
67
|
+
| 选项 | 类型 | 说明 |
|
|
68
|
+
|------|------|------|
|
|
69
|
+
| `--env` | string | 目标环境(dev\|test\|prod-cn\|prod-jp) |
|
|
70
|
+
| `--tenant` | string | 租户代码 |
|
|
71
|
+
| `--dry-run` | boolean | 预览模式 |
|
|
72
|
+
| `--json` | boolean | JSON输出 |
|
|
73
|
+
|
|
74
|
+
### 命令选项
|
|
75
|
+
| 选项 | 短选项 | 类型 | 必填 | 默认值 | 说明 | 对应DTO字段 |
|
|
76
|
+
|------|--------|------|------|--------|------|-------------|
|
|
77
|
+
| --client-id | -c | string | ✅ | - | 客户ID | clientId |
|
|
78
|
+
| --name | -n | string | ✅ | - | 姓名 | clientContactName |
|
|
79
|
+
| --phone | -p | string | ⬜ | - | 手机号 | clientContactPhone |
|
|
80
|
+
| --telephone | -t | string | ⬜ | - | 座机号 | clientContactTelephone |
|
|
81
|
+
| --email | -e | string | ⬜ | - | 电子邮箱 | clientContactEmail |
|
|
82
|
+
| --sex | -s | string | ⬜ | - | 性别 | clientContactSex |
|
|
83
|
+
| --birthday | -b | string | ⬜ | - | 生日(YYYY-MM-DD) | clientContactBirthday |
|
|
84
|
+
| --qq | -q | string | ⬜ | - | QQ号 | clientContactQq |
|
|
85
|
+
| --wechat | -w | string | ⬜ | - | 微信号 | clientContactWechat |
|
|
86
|
+
| --address | -a | string | ⬜ | - | 详细地址 | clientContactAddress |
|
|
87
|
+
| --default | -d | boolean | ⬜ | N | 是否默认联系人 | defaultFlag |
|
|
88
|
+
| --remark | -r | string | ⬜ | - | 备注 | remark |
|
|
89
|
+
|
|
90
|
+
## 2.4 字段映射表
|
|
91
|
+
|
|
92
|
+
| CLI参数 | DTO字段 | 类型转换 | 验证规则 |
|
|
93
|
+
|---------|---------|----------|----------|
|
|
94
|
+
| --client-id / -c | clientId | string→Long | @NotNull |
|
|
95
|
+
| --name / -n | clientContactName | 直接传递 | @NotBlank, max=255 |
|
|
96
|
+
| --phone / -p | clientContactPhone | 直接传递 | max=256 |
|
|
97
|
+
| --telephone / -t | clientContactTelephone | 直接传递 | max=256 |
|
|
98
|
+
| --email / -e | clientContactEmail | 直接传递 | max=512 |
|
|
99
|
+
| --sex / -s | clientContactSex | 直接传递 | max=255 |
|
|
100
|
+
| --birthday / -b | clientContactBirthday | string→Date | yyyy-MM-dd |
|
|
101
|
+
| --qq / -q | clientContactQq | 直接传递 | max=512 |
|
|
102
|
+
| --wechat / -w | clientContactWechat | 直接传递 | max=512 |
|
|
103
|
+
| --address / -a | clientContactAddress | 直接传递 | max=512 |
|
|
104
|
+
| --default / -d | defaultFlag | boolean→Y/N | @NotBlank, max=1 |
|
|
105
|
+
| --remark / -r | remark | 直接传递 | max=255 |
|
|
106
|
+
|
|
107
|
+
## 2.5 错误码引用
|
|
108
|
+
|
|
109
|
+
### ExceptionEnum位置
|
|
110
|
+
```
|
|
111
|
+
coffee-liberica-end/
|
|
112
|
+
└── business/liberica-business-sales/sales-api/
|
|
113
|
+
└── src/main/java/com/newpeak/liberica/sales/api/exception/enums/
|
|
114
|
+
└── MasterClientContactExceptionEnum.java
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 已知错误码
|
|
118
|
+
| 错误码 | 错误消息 | 触发条件 |
|
|
119
|
+
|--------|----------|----------|
|
|
120
|
+
| 01001207001 | 租户客户联系人不存在 | 客户ID不存在 |
|
|
121
|
+
| 01001XXX... | 相关验证错误 | 字段验证失败 |
|
|
122
|
+
|
|
123
|
+
## 2.6 权限检查
|
|
124
|
+
|
|
125
|
+
| 检查项 | 位置 | 说明 |
|
|
126
|
+
|--------|------|------|
|
|
127
|
+
| PermissionConstants | `ADD_MASTER_CLIENT_CONTACT` | 添加客户联系人需要此权限 |
|
|
128
|
+
| 注解 | `@PostResource(requirePermissionCode = "ADD_MASTER_CLIENT_CONTACT")` | Controller方法上 |
|
|
129
|
+
|
|
130
|
+
## 2.7 实现要点
|
|
131
|
+
|
|
132
|
+
1. **必填参数**:--client-id 和 --name 必须指定
|
|
133
|
+
2. **defaultFlag**:--default 不指定时默认为 "N",指定时为 "Y"
|
|
134
|
+
3. **dry-run 模式**:预览模式下只显示将要发送的数据,不实际调用 API
|
|
135
|
+
4. **输出格式**:成功后显示创建的联系人信息
|
|
136
|
+
5. **错误处理**:字段验证错误显示友好提示
|
|
137
|
+
|
|
138
|
+
## 2.8 示例用法
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 创建客户联系人(dry-run 预览)
|
|
142
|
+
barista liberica client-contacts create --client-id 123 --name "张三" --phone "13800138000" --dry-run
|
|
143
|
+
|
|
144
|
+
# 实际创建
|
|
145
|
+
barista liberica client-contacts create --client-id 123 --name "张三" --phone "13800138000" --email "zhang@example.com"
|
|
146
|
+
|
|
147
|
+
# 创建默认联系人
|
|
148
|
+
barista liberica client-contacts create --client-id 123 --name "李四" --default --address "北京市朝阳区xxx"
|
|
149
|
+
|
|
150
|
+
# JSON 输出
|
|
151
|
+
barista liberica client-contacts create --client-id 123 --name "张三" --json
|
|
152
|
+
```
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# barista liberica client-contacts delete
|
|
2
|
+
|
|
3
|
+
删除客户联系人。
|
|
4
|
+
|
|
5
|
+
## 2.1 命令元数据
|
|
6
|
+
|
|
7
|
+
| 字段 | 值 |
|
|
8
|
+
|------|-----|
|
|
9
|
+
| 完整命令 | `barista liberica client-contacts delete <contact-id>` |
|
|
10
|
+
| 功能描述 | 删除客户联系人 |
|
|
11
|
+
| HTTP方法 | POST |
|
|
12
|
+
| 是否需要认证 | ✅ 是 |
|
|
13
|
+
| 是否支持dry-run | ✅ 是(默认) |
|
|
14
|
+
|
|
15
|
+
## 2.2 后端接口引用
|
|
16
|
+
|
|
17
|
+
### Controller位置
|
|
18
|
+
```
|
|
19
|
+
coffee-liberica-end/
|
|
20
|
+
└── facade/liberica-facade-enterprise/
|
|
21
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/sales/
|
|
22
|
+
└── EnterpriseClientContactController.java
|
|
23
|
+
└── delete(@PostResource(path = "/delete", requiredPermission = true, requirePermissionCode = "DEL_MASTER_CLIENT_CONTACT"))
|
|
24
|
+
└── public ResponseData<?> delete(
|
|
25
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
26
|
+
@RequestBody @Validated(BaseRequest.delete.class) MasterClientContactRequest masterClientContactRequest
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Request DTO位置
|
|
31
|
+
```
|
|
32
|
+
coffee-liberica-end/
|
|
33
|
+
└── business/liberica-business-sales/sales-api/
|
|
34
|
+
└── src/main/java/com/newpeak/liberica/sales/api/pojo/request/
|
|
35
|
+
└── MasterClientContactRequest.java
|
|
36
|
+
└── clientContactId: Long (@NotNull on delete)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Response DTO位置
|
|
40
|
+
```
|
|
41
|
+
coffee-liberica-end/
|
|
42
|
+
└── business/liberica-business-sales/sales-api/
|
|
43
|
+
└── src/main/java/com/newpeak/liberica/sales/api/pojo/response/
|
|
44
|
+
└── SuccessResponseData<?>
|
|
45
|
+
└── 无具体数据
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 2.3 CLI参数设计
|
|
49
|
+
|
|
50
|
+
### 命令结构
|
|
51
|
+
```
|
|
52
|
+
barista liberica client-contacts delete <contact-id> [options]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 位置参数
|
|
56
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
57
|
+
|------|------|------|------|
|
|
58
|
+
| contact-id | string | ✅ | 客户联系人ID |
|
|
59
|
+
|
|
60
|
+
### 全局选项
|
|
61
|
+
| 选项 | 类型 | 说明 |
|
|
62
|
+
|------|------|------|
|
|
63
|
+
| `--env` | string | 目标环境(dev\|test\|prod-cn\|prod-jp) |
|
|
64
|
+
| `--tenant` | string | 租户代码 |
|
|
65
|
+
| `--dry-run` | boolean | 预览模式(默认开启) |
|
|
66
|
+
| `--force` | boolean | 跳过确认,直接执行删除 |
|
|
67
|
+
| `--json` | boolean | JSON输出 |
|
|
68
|
+
|
|
69
|
+
## 2.4 字段映射表
|
|
70
|
+
|
|
71
|
+
| CLI参数 | DTO字段 | 类型转换 | 验证规则 |
|
|
72
|
+
|---------|---------|----------|----------|
|
|
73
|
+
| <contact-id> | clientContactId | string→Long | @NotNull |
|
|
74
|
+
|
|
75
|
+
## 2.5 错误码引用
|
|
76
|
+
|
|
77
|
+
### ExceptionEnum位置
|
|
78
|
+
```
|
|
79
|
+
coffee-liberica-end/
|
|
80
|
+
└── business/liberica-business-sales/sales-api/
|
|
81
|
+
└── src/main/java/com/newpeak/liberica/sales/api/exception/enums/
|
|
82
|
+
└── MasterClientContactExceptionEnum.java
|
|
83
|
+
└── MASTER_CLIENT_CONTACT_NOT_EXIST("01001207001", "租户客户联系人不存在")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 已知错误码
|
|
87
|
+
| 错误码 | 错误消息 | 触发条件 |
|
|
88
|
+
|--------|----------|----------|
|
|
89
|
+
| 01001207001 | 租户客户联系人不存在 | contact-id 不存在或不属于当前租户 |
|
|
90
|
+
|
|
91
|
+
## 2.6 权限检查
|
|
92
|
+
|
|
93
|
+
| 检查项 | 位置 | 说明 |
|
|
94
|
+
|--------|------|------|
|
|
95
|
+
| PermissionConstants | `DEL_MASTER_CLIENT_CONTACT` | 删除客户联系人需要此权限 |
|
|
96
|
+
| 注解 | `@PostResource(requirePermissionCode = "DEL_MASTER_CLIENT_CONTACT")` | Controller方法上 |
|
|
97
|
+
|
|
98
|
+
## 2.7 实现要点
|
|
99
|
+
|
|
100
|
+
1. **位置参数**:contact-id 必须指定
|
|
101
|
+
2. **默认 dry-run**:不带 --force 时默认是 dry-run 模式,只预览不执行
|
|
102
|
+
3. **--force 确认**:实际删除前必须显式指定 --force
|
|
103
|
+
4. **输出格式**:预览模式显示将要删除的联系人信息,确认后显示删除结果
|
|
104
|
+
5. **错误处理**:联系人不存在时显示友好错误信息
|
|
105
|
+
|
|
106
|
+
## 2.8 示例用法
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 预览删除(默认 dry-run)
|
|
110
|
+
barista liberica client-contacts delete 12345
|
|
111
|
+
# 输出: 🔍 Dry-Run 模式:不会实际删除
|
|
112
|
+
# 将删除联系人: 张三 (ID: 12345)
|
|
113
|
+
# 添加 --force 选项以确认删除
|
|
114
|
+
|
|
115
|
+
# 确认删除
|
|
116
|
+
barista liberica client-contacts delete 12345 --force
|
|
117
|
+
|
|
118
|
+
# JSON 预览
|
|
119
|
+
barista liberica client-contacts delete 12345 --json
|
|
120
|
+
|
|
121
|
+
# JSON 确认删除
|
|
122
|
+
barista liberica client-contacts delete 12345 --force --json
|
|
123
|
+
```
|