py-chanjet-toolkit 1.0.0__tar.gz
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.
- py_chanjet_toolkit-1.0.0/LICENSE +21 -0
- py_chanjet_toolkit-1.0.0/PKG-INFO +274 -0
- py_chanjet_toolkit-1.0.0/README.md +216 -0
- py_chanjet_toolkit-1.0.0/pyproject.toml +49 -0
- py_chanjet_toolkit-1.0.0/setup.cfg +4 -0
- py_chanjet_toolkit-1.0.0/src/py_chajet_toolkit/__init__.py +26 -0
- py_chanjet_toolkit-1.0.0/src/py_chajet_toolkit/tplus/__init__.py +15 -0
- py_chanjet_toolkit-1.0.0/src/py_chajet_toolkit/tplus/zkhb/__init__.py +145 -0
- py_chanjet_toolkit-1.0.0/src/py_chajet_toolkit/tplus/zkhb/responses.py +32 -0
- py_chanjet_toolkit-1.0.0/src/py_chajet_toolkit/tplus/zkhb/utils.py +376 -0
- py_chanjet_toolkit-1.0.0/src/py_chanjet_toolkit.egg-info/PKG-INFO +274 -0
- py_chanjet_toolkit-1.0.0/src/py_chanjet_toolkit.egg-info/SOURCES.txt +13 -0
- py_chanjet_toolkit-1.0.0/src/py_chanjet_toolkit.egg-info/dependency_links.txt +1 -0
- py_chanjet_toolkit-1.0.0/src/py_chanjet_toolkit.egg-info/requires.txt +6 -0
- py_chanjet_toolkit-1.0.0/src/py_chanjet_toolkit.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 郭磊
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-chanjet-toolkit
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: 畅捷通 T+ Python 客户端库,提供与畅捷通 T+ 智慧社区系统的 WebService 接口交互能力,支持同步和异步调用。
|
|
5
|
+
Author-email: Guolei <174000902@qq.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 郭磊
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://gitee.com/guolei19850528/py_chanjet_toolkit
|
|
29
|
+
Project-URL: Repository, https://gitee.com/guolei19850528/py_chanjet_toolkit.git
|
|
30
|
+
Project-URL: Issues, https://gitee.com/guolei19850528/py_chanjet_toolkit/issues
|
|
31
|
+
Project-URL: Documentation, https://gitee.com/guolei19850528/py_chanjet_toolkit/wikis
|
|
32
|
+
Keywords: chanjet,tplus,畅捷通,智慧社区,webservice,soap,api,client,async
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Development Status :: 4 - Beta
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: Intended Audience :: System Administrators
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
42
|
+
Classifier: Operating System :: OS Independent
|
|
43
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
44
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
45
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
46
|
+
Classifier: Framework :: AsyncIO
|
|
47
|
+
Classifier: Typing :: Typed
|
|
48
|
+
Requires-Python: >=3.10
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
License-File: LICENSE
|
|
51
|
+
Requires-Dist: pydantic>=2.0
|
|
52
|
+
Requires-Dist: jsonpath-ng>=1.5.3
|
|
53
|
+
Requires-Dist: jsonschema>=4.21.0
|
|
54
|
+
Requires-Dist: xmltodict>=1.0.4
|
|
55
|
+
Requires-Dist: arrow>=1.4.0
|
|
56
|
+
Requires-Dist: py-httpx-toolkit>=1.0.1
|
|
57
|
+
Dynamic: license-file
|
|
58
|
+
|
|
59
|
+
# py-chajet-toolkit
|
|
60
|
+
|
|
61
|
+
畅捷通 T+ 系列产品的 Python 客户端库,提供与畅捷通 T+ 系统的 API 交互能力。
|
|
62
|
+
|
|
63
|
+
## 功能特性
|
|
64
|
+
|
|
65
|
+
- 提供畅捷通 T+ 智慧社区 WebService 接口的同步和异步调用
|
|
66
|
+
- 封装 SOAP 请求的构建和响应解析
|
|
67
|
+
- 提供数据校验、日期处理、SQL 生成等辅助工具函数
|
|
68
|
+
- 支持 JSONPath 查询和 JSON Schema 校验
|
|
69
|
+
|
|
70
|
+
## 安装方式
|
|
71
|
+
|
|
72
|
+
### 使用 pip 安装
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install py-chajet-toolkit
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 使用 uv 安装
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv add py-chajet-toolkit
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 快速开始
|
|
85
|
+
|
|
86
|
+
### 基础使用示例
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from py_chajet_toolkit.tplus.zkhb import ForcelandEstateService
|
|
90
|
+
from py_chajet_toolkit.tplus.zkhb.utils import (
|
|
91
|
+
build_get_data_set_post_xml,
|
|
92
|
+
build_get_data_set_results,
|
|
93
|
+
build_actual_payment_items_query_sql
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# 初始化服务客户端
|
|
97
|
+
service = ForcelandEstateService(base_url="http://your-server/estate")
|
|
98
|
+
|
|
99
|
+
# 构建 SOAP 请求体
|
|
100
|
+
xml_data = build_get_data_set_post_xml({"sql": "SELECT * FROM EstateDetail"})
|
|
101
|
+
|
|
102
|
+
# 同步调用接口
|
|
103
|
+
response = service.get_data_set(content=xml_data)
|
|
104
|
+
|
|
105
|
+
# 解析响应数据
|
|
106
|
+
results = build_get_data_set_results(response)
|
|
107
|
+
print(results)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 异步调用示例
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import asyncio
|
|
114
|
+
from py_chajet_toolkit.tplus.zkhb import ForcelandEstateService
|
|
115
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_post_xml, build_get_data_set_results
|
|
116
|
+
|
|
117
|
+
async def main():
|
|
118
|
+
service = ForcelandEstateService(base_url="http://your-server/estate")
|
|
119
|
+
xml_data = build_get_data_set_post_xml({"sql": "SELECT * FROM ChargeMasterList"})
|
|
120
|
+
|
|
121
|
+
# 异步调用接口
|
|
122
|
+
response = await service.async_get_data_set(content=xml_data)
|
|
123
|
+
results = build_get_data_set_results(response)
|
|
124
|
+
print(results)
|
|
125
|
+
|
|
126
|
+
asyncio.run(main())
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## API 说明
|
|
130
|
+
|
|
131
|
+
### ForcelandEstateService
|
|
132
|
+
|
|
133
|
+
畅捷通T+智慧社区服务客户端类,封装了与畅捷通T+智慧社区系统的WebService接口交互。
|
|
134
|
+
|
|
135
|
+
#### 初始化
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
service = ForcelandEstateService(
|
|
139
|
+
base_url="http://your-server/estate",
|
|
140
|
+
client_kwargs={"timeout": 120}
|
|
141
|
+
)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### 同步方法
|
|
145
|
+
|
|
146
|
+
- `get_data_set(client=None, client_kwargs=None, **kwargs)` - 调用 GetDataSet 接口
|
|
147
|
+
|
|
148
|
+
#### 异步方法
|
|
149
|
+
|
|
150
|
+
- `async_get_data_set(client=None, client_kwargs=None, **kwargs)` - 异步调用 GetDataSet 接口
|
|
151
|
+
|
|
152
|
+
## Utils 工具函数
|
|
153
|
+
|
|
154
|
+
### json_find_first
|
|
155
|
+
|
|
156
|
+
使用 JSONPath 表达式从嵌套的 JSON 数据中查找第一个匹配项。
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from py_chajet_toolkit.tplus.zkhb.utils import json_find_first
|
|
160
|
+
|
|
161
|
+
data = {"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]}
|
|
162
|
+
result = json_find_first("$.users[0].name", data)
|
|
163
|
+
# 返回: 'Alice'
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### json_is_valid
|
|
167
|
+
|
|
168
|
+
校验 JSON 数据是否符合指定的 JSON Schema 规范。
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from py_chajet_toolkit.tplus.zkhb.utils import json_is_valid
|
|
172
|
+
|
|
173
|
+
schema = {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"properties": {"id": {"type": "string"}},
|
|
176
|
+
"required": ["id"]
|
|
177
|
+
}
|
|
178
|
+
is_valid = json_is_valid(schema, {"id": "123"})
|
|
179
|
+
# 返回: True
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### build_get_data_set_post_xml
|
|
183
|
+
|
|
184
|
+
将请求数据转换为 SOAP GetDataSet 接口所需的 XML 格式。
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_post_xml
|
|
188
|
+
|
|
189
|
+
xml = build_get_data_set_post_xml({"sql": "SELECT * FROM EstateDetail"})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### build_get_data_set_results
|
|
193
|
+
|
|
194
|
+
从 GetDataSet 接口响应中提取实际数据列表。
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_results
|
|
198
|
+
|
|
199
|
+
results = build_get_data_set_results(response)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### build_actual_payment_items_query_sql
|
|
203
|
+
|
|
204
|
+
生成查询实际支付项目的 SQL 语句。
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_actual_payment_items_query_sql
|
|
208
|
+
|
|
209
|
+
sql = build_actual_payment_items_query_sql(
|
|
210
|
+
conditions="and cml.EstateID='E001'",
|
|
211
|
+
order_by="order by cml.CreateTime desc"
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### payment_date_range_is_valid
|
|
216
|
+
|
|
217
|
+
验证支付金额与日期范围是否匹配。
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from py_chajet_toolkit.tplus.zkhb.utils import payment_date_range_is_valid
|
|
221
|
+
|
|
222
|
+
is_valid = payment_date_range_is_valid(
|
|
223
|
+
daily_fee=10,
|
|
224
|
+
total_amount=300,
|
|
225
|
+
start="2024-01-01",
|
|
226
|
+
end="2024-01-31"
|
|
227
|
+
)
|
|
228
|
+
# 返回: True
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### filter_actual_payment_items
|
|
232
|
+
|
|
233
|
+
过滤实际支付记录,移除配对的充值和退款记录。
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
from py_chajet_toolkit.tplus.zkhb.utils import filter_actual_payment_items
|
|
237
|
+
|
|
238
|
+
filtered_items = filter_actual_payment_items(actual_payment_items)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## 项目结构
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
py_chajet_toolkit/
|
|
245
|
+
├── tplus/
|
|
246
|
+
│ ├── zkhb/
|
|
247
|
+
│ │ ├── __init__.py # 智慧社区服务客户端类
|
|
248
|
+
│ │ ├── utils.py # 工具函数集合
|
|
249
|
+
│ │ └── responses.py # 响应处理模块
|
|
250
|
+
│ └── __init__.py
|
|
251
|
+
└── __init__.py
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## 依赖
|
|
255
|
+
|
|
256
|
+
- arrow - 日期时间处理
|
|
257
|
+
- httpx - HTTP 客户端
|
|
258
|
+
- jsonpath_ng - JSONPath 查询
|
|
259
|
+
- jsonschema - JSON Schema 校验
|
|
260
|
+
- xmltodict - XML 与字典转换
|
|
261
|
+
- py_httpx_toolkit - HTTP 工具封装
|
|
262
|
+
|
|
263
|
+
## 项目主页
|
|
264
|
+
|
|
265
|
+
[https://gitee.com/guolei19850528/py_chanjet_toolkit](https://gitee.com/guolei19850528/py_chanjet_toolkit)
|
|
266
|
+
|
|
267
|
+
## 作者
|
|
268
|
+
|
|
269
|
+
**Author**: Lei Guo
|
|
270
|
+
**Email**: guolei@example.com
|
|
271
|
+
|
|
272
|
+
## 许可证
|
|
273
|
+
|
|
274
|
+
MIT License
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# py-chajet-toolkit
|
|
2
|
+
|
|
3
|
+
畅捷通 T+ 系列产品的 Python 客户端库,提供与畅捷通 T+ 系统的 API 交互能力。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 提供畅捷通 T+ 智慧社区 WebService 接口的同步和异步调用
|
|
8
|
+
- 封装 SOAP 请求的构建和响应解析
|
|
9
|
+
- 提供数据校验、日期处理、SQL 生成等辅助工具函数
|
|
10
|
+
- 支持 JSONPath 查询和 JSON Schema 校验
|
|
11
|
+
|
|
12
|
+
## 安装方式
|
|
13
|
+
|
|
14
|
+
### 使用 pip 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install py-chajet-toolkit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 使用 uv 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv add py-chajet-toolkit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 快速开始
|
|
27
|
+
|
|
28
|
+
### 基础使用示例
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from py_chajet_toolkit.tplus.zkhb import ForcelandEstateService
|
|
32
|
+
from py_chajet_toolkit.tplus.zkhb.utils import (
|
|
33
|
+
build_get_data_set_post_xml,
|
|
34
|
+
build_get_data_set_results,
|
|
35
|
+
build_actual_payment_items_query_sql
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# 初始化服务客户端
|
|
39
|
+
service = ForcelandEstateService(base_url="http://your-server/estate")
|
|
40
|
+
|
|
41
|
+
# 构建 SOAP 请求体
|
|
42
|
+
xml_data = build_get_data_set_post_xml({"sql": "SELECT * FROM EstateDetail"})
|
|
43
|
+
|
|
44
|
+
# 同步调用接口
|
|
45
|
+
response = service.get_data_set(content=xml_data)
|
|
46
|
+
|
|
47
|
+
# 解析响应数据
|
|
48
|
+
results = build_get_data_set_results(response)
|
|
49
|
+
print(results)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 异步调用示例
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import asyncio
|
|
56
|
+
from py_chajet_toolkit.tplus.zkhb import ForcelandEstateService
|
|
57
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_post_xml, build_get_data_set_results
|
|
58
|
+
|
|
59
|
+
async def main():
|
|
60
|
+
service = ForcelandEstateService(base_url="http://your-server/estate")
|
|
61
|
+
xml_data = build_get_data_set_post_xml({"sql": "SELECT * FROM ChargeMasterList"})
|
|
62
|
+
|
|
63
|
+
# 异步调用接口
|
|
64
|
+
response = await service.async_get_data_set(content=xml_data)
|
|
65
|
+
results = build_get_data_set_results(response)
|
|
66
|
+
print(results)
|
|
67
|
+
|
|
68
|
+
asyncio.run(main())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## API 说明
|
|
72
|
+
|
|
73
|
+
### ForcelandEstateService
|
|
74
|
+
|
|
75
|
+
畅捷通T+智慧社区服务客户端类,封装了与畅捷通T+智慧社区系统的WebService接口交互。
|
|
76
|
+
|
|
77
|
+
#### 初始化
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
service = ForcelandEstateService(
|
|
81
|
+
base_url="http://your-server/estate",
|
|
82
|
+
client_kwargs={"timeout": 120}
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### 同步方法
|
|
87
|
+
|
|
88
|
+
- `get_data_set(client=None, client_kwargs=None, **kwargs)` - 调用 GetDataSet 接口
|
|
89
|
+
|
|
90
|
+
#### 异步方法
|
|
91
|
+
|
|
92
|
+
- `async_get_data_set(client=None, client_kwargs=None, **kwargs)` - 异步调用 GetDataSet 接口
|
|
93
|
+
|
|
94
|
+
## Utils 工具函数
|
|
95
|
+
|
|
96
|
+
### json_find_first
|
|
97
|
+
|
|
98
|
+
使用 JSONPath 表达式从嵌套的 JSON 数据中查找第一个匹配项。
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from py_chajet_toolkit.tplus.zkhb.utils import json_find_first
|
|
102
|
+
|
|
103
|
+
data = {"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]}
|
|
104
|
+
result = json_find_first("$.users[0].name", data)
|
|
105
|
+
# 返回: 'Alice'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### json_is_valid
|
|
109
|
+
|
|
110
|
+
校验 JSON 数据是否符合指定的 JSON Schema 规范。
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from py_chajet_toolkit.tplus.zkhb.utils import json_is_valid
|
|
114
|
+
|
|
115
|
+
schema = {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"properties": {"id": {"type": "string"}},
|
|
118
|
+
"required": ["id"]
|
|
119
|
+
}
|
|
120
|
+
is_valid = json_is_valid(schema, {"id": "123"})
|
|
121
|
+
# 返回: True
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### build_get_data_set_post_xml
|
|
125
|
+
|
|
126
|
+
将请求数据转换为 SOAP GetDataSet 接口所需的 XML 格式。
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_post_xml
|
|
130
|
+
|
|
131
|
+
xml = build_get_data_set_post_xml({"sql": "SELECT * FROM EstateDetail"})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### build_get_data_set_results
|
|
135
|
+
|
|
136
|
+
从 GetDataSet 接口响应中提取实际数据列表。
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_get_data_set_results
|
|
140
|
+
|
|
141
|
+
results = build_get_data_set_results(response)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### build_actual_payment_items_query_sql
|
|
145
|
+
|
|
146
|
+
生成查询实际支付项目的 SQL 语句。
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from py_chajet_toolkit.tplus.zkhb.utils import build_actual_payment_items_query_sql
|
|
150
|
+
|
|
151
|
+
sql = build_actual_payment_items_query_sql(
|
|
152
|
+
conditions="and cml.EstateID='E001'",
|
|
153
|
+
order_by="order by cml.CreateTime desc"
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### payment_date_range_is_valid
|
|
158
|
+
|
|
159
|
+
验证支付金额与日期范围是否匹配。
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from py_chajet_toolkit.tplus.zkhb.utils import payment_date_range_is_valid
|
|
163
|
+
|
|
164
|
+
is_valid = payment_date_range_is_valid(
|
|
165
|
+
daily_fee=10,
|
|
166
|
+
total_amount=300,
|
|
167
|
+
start="2024-01-01",
|
|
168
|
+
end="2024-01-31"
|
|
169
|
+
)
|
|
170
|
+
# 返回: True
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### filter_actual_payment_items
|
|
174
|
+
|
|
175
|
+
过滤实际支付记录,移除配对的充值和退款记录。
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from py_chajet_toolkit.tplus.zkhb.utils import filter_actual_payment_items
|
|
179
|
+
|
|
180
|
+
filtered_items = filter_actual_payment_items(actual_payment_items)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 项目结构
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
py_chajet_toolkit/
|
|
187
|
+
├── tplus/
|
|
188
|
+
│ ├── zkhb/
|
|
189
|
+
│ │ ├── __init__.py # 智慧社区服务客户端类
|
|
190
|
+
│ │ ├── utils.py # 工具函数集合
|
|
191
|
+
│ │ └── responses.py # 响应处理模块
|
|
192
|
+
│ └── __init__.py
|
|
193
|
+
└── __init__.py
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 依赖
|
|
197
|
+
|
|
198
|
+
- arrow - 日期时间处理
|
|
199
|
+
- httpx - HTTP 客户端
|
|
200
|
+
- jsonpath_ng - JSONPath 查询
|
|
201
|
+
- jsonschema - JSON Schema 校验
|
|
202
|
+
- xmltodict - XML 与字典转换
|
|
203
|
+
- py_httpx_toolkit - HTTP 工具封装
|
|
204
|
+
|
|
205
|
+
## 项目主页
|
|
206
|
+
|
|
207
|
+
[https://gitee.com/guolei19850528/py_chanjet_toolkit](https://gitee.com/guolei19850528/py_chanjet_toolkit)
|
|
208
|
+
|
|
209
|
+
## 作者
|
|
210
|
+
|
|
211
|
+
**Author**: Lei Guo
|
|
212
|
+
**Email**: guolei@example.com
|
|
213
|
+
|
|
214
|
+
## 许可证
|
|
215
|
+
|
|
216
|
+
MIT License
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py-chanjet-toolkit"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Guolei", email = "174000902@qq.com" }
|
|
11
|
+
]
|
|
12
|
+
description = "畅捷通 T+ Python 客户端库,提供与畅捷通 T+ 智慧社区系统的 WebService 接口交互能力,支持同步和异步调用。"
|
|
13
|
+
keywords = ["chanjet", "tplus", "畅捷通", "智慧社区", "webservice", "soap", "api", "client", "async"]
|
|
14
|
+
license = { file = "LICENSE" }
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
classifiers = [
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: System Administrators",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
29
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
30
|
+
"Framework :: AsyncIO",
|
|
31
|
+
"Typing :: Typed",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"pydantic>=2.0",
|
|
35
|
+
"jsonpath-ng>=1.5.3",
|
|
36
|
+
"jsonschema>=4.21.0",
|
|
37
|
+
"xmltodict>=1.0.4",
|
|
38
|
+
"arrow>=1.4.0",
|
|
39
|
+
"py-httpx-toolkit>=1.0.1",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
"Homepage" = "https://gitee.com/guolei19850528/py_chanjet_toolkit"
|
|
44
|
+
"Repository" = "https://gitee.com/guolei19850528/py_chanjet_toolkit.git"
|
|
45
|
+
"Issues" = "https://gitee.com/guolei19850528/py_chanjet_toolkit/issues"
|
|
46
|
+
"Documentation" = "https://gitee.com/guolei19850528/py_chanjet_toolkit/wikis"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
py_chajet 包入口模块
|
|
5
|
+
|
|
6
|
+
该包是畅捷通 T+ 系列产品的 Python 客户端库,提供与畅捷通 T+ 系统的 API 交互能力。
|
|
7
|
+
|
|
8
|
+
包结构:
|
|
9
|
+
- py_chajet/
|
|
10
|
+
- tplus/ # T+ 系列产品模块
|
|
11
|
+
- zkhb/ # 智慧社区业务模块
|
|
12
|
+
- __init__.py # 智慧社区服务客户端类
|
|
13
|
+
- utils.py # 工具函数集合
|
|
14
|
+
|
|
15
|
+
主要功能:
|
|
16
|
+
- 提供畅捷通 T+ 智慧社区 WebService 接口的同步和异步调用
|
|
17
|
+
- 封装 SOAP 请求的构建和响应解析
|
|
18
|
+
- 提供数据校验、日期处理、SQL 生成等辅助工具函数
|
|
19
|
+
|
|
20
|
+
使用示例:
|
|
21
|
+
from py_chajet.tplus.zkhb import ForcelandEstateService
|
|
22
|
+
|
|
23
|
+
service = ForcelandEstateService(base_url="http://your-server/estate")
|
|
24
|
+
response = service.get_data_set()
|
|
25
|
+
data = convert_to_get_data_set_results(response)
|
|
26
|
+
"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
py_chajet.tplus 模块
|
|
5
|
+
|
|
6
|
+
该模块包含畅捷通 T+ 系列产品的客户端实现,目前主要包含智慧社区(zkhb)业务模块。
|
|
7
|
+
|
|
8
|
+
子模块:
|
|
9
|
+
- zkhb: 智慧社区业务模块,提供与智慧社区系统的 WebService 接口交互能力
|
|
10
|
+
|
|
11
|
+
未来扩展计划:
|
|
12
|
+
- 添加更多 T+ 产品线的客户端支持
|
|
13
|
+
- 提供统一的 API 调用接口
|
|
14
|
+
- 增加数据模型和类型定义
|
|
15
|
+
"""
|