smartpush 1.3.2__tar.gz → 1.3.4__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.
- {smartpush-1.3.2 → smartpush-1.3.4}/PKG-INFO +1 -1
- {smartpush-1.3.2 → smartpush-1.3.4}/setup.py +1 -1
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/get_jira_info.py +53 -24
- smartpush-1.3.4/smartpush/utils/__init__.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush.egg-info/PKG-INFO +1 -1
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush.egg-info/SOURCES.txt +1 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/README.md +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/setup.cfg +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/__init__.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/export/__init__.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/export/basic/ExcelExportChecker.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/export/basic/GetOssUrl.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/export/basic/ReadExcel.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/export/basic/__init__.py +0 -0
- /smartpush-1.3.2/smartpush/utils/__init__.py → /smartpush-1.3.4/smartpush/test.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/utils/DataTypeUtils.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush/utils/StringUtils.py +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush.egg-info/dependency_links.txt +0 -0
- {smartpush-1.3.2 → smartpush-1.3.4}/smartpush.egg-info/top_level.txt +0 -0
@@ -2,14 +2,24 @@ import datetime
|
|
2
2
|
import json
|
3
3
|
import requests
|
4
4
|
from jira import JIRA
|
5
|
-
|
5
|
+
from datetime import datetime
|
6
6
|
from smartpush.utils.StringUtils import StringUtils
|
7
7
|
|
8
8
|
test_user = {
|
9
9
|
"邵宇飞": "dw_shaoyufei",
|
10
10
|
"卢泽彬-Lulu-QA": "dw_luzebin",
|
11
11
|
"xiangchen zhong": "dw_zhongxiangchen",
|
12
|
-
"周彦龙": "
|
12
|
+
"周彦龙": "dw_zhouyanlong",
|
13
|
+
"梁铭津-bryant": "dw_liangmingjin",
|
14
|
+
"高忠明 - gaozhongming": "dw_gaozhongming",
|
15
|
+
"jiayong zhang": "dw_zhangjiayong",
|
16
|
+
"毕杰芳-Dawn Bi": "dw_bijiefang",
|
17
|
+
"李志": "dw_lizhi7",
|
18
|
+
"张玉吉-小橙C": "dw_zhangyuji",
|
19
|
+
"周艳辉-zhouyanhui-QA": "dw_zhouyanhui",
|
20
|
+
"zhaoyi wang": "dw_wangzhaoyi",
|
21
|
+
"测试-陈美伶-Zoe": "dw_chenmeiling",
|
22
|
+
"黄伟灵": "dw_huangweiling"
|
13
23
|
}
|
14
24
|
|
15
25
|
|
@@ -61,27 +71,27 @@ def get_update_issues_jql():
|
|
61
71
|
|
62
72
|
|
63
73
|
class JiraInfo:
|
64
|
-
def __init__(self, _jira_user, _api_key
|
74
|
+
def __init__(self, _jira_user, _api_key):
|
65
75
|
self.project_name = None
|
66
76
|
self.jira_url = "https://shopline.atlassian.net/"
|
67
|
-
self.project_key = _project_key
|
77
|
+
# self.project_key = _project_key
|
68
78
|
self.issue = None
|
69
79
|
self.jira_user = _jira_user
|
70
80
|
self.jira_api_key = _api_key
|
71
81
|
self.jira = JIRA(server=self.jira_url, basic_auth=(self.jira_user, self.jira_api_key))
|
72
|
-
self.get_jira_prodcut()
|
82
|
+
# self.get_jira_prodcut()
|
73
83
|
self.custom_fields = self.get_custom_fields()
|
74
84
|
|
75
|
-
def get_jira_prodcut(self):
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
85
|
+
# def get_jira_prodcut(self):
|
86
|
+
# """"""
|
87
|
+
# project = self.jira.project(str(self.project_key))
|
88
|
+
# self.project_name = project.name
|
89
|
+
# print(f"Project: {project.key} - {project.name}")
|
80
90
|
# return project
|
81
91
|
|
82
92
|
def get_custom_fields(self) -> dict:
|
83
93
|
"""
|
84
|
-
查询指定项目jira中的自定义字段,smartpush项目是 10559
|
94
|
+
查询指定项目jira中的自定义字段,smartpush项目是 10559 商品是 10092
|
85
95
|
@param project_id: 项目id
|
86
96
|
@param jira_obj: 对象
|
87
97
|
@return: 返回的是自定义的值对应的id
|
@@ -92,10 +102,7 @@ class JiraInfo:
|
|
92
102
|
for field in all_fields:
|
93
103
|
try:
|
94
104
|
if field.get('custom'):
|
95
|
-
# if field['scope']['project']['id'] == self.project_key:
|
96
105
|
custom_fields[field['id']] = field['name']
|
97
|
-
# else:
|
98
|
-
# pass
|
99
106
|
except:
|
100
107
|
continue
|
101
108
|
# print(custom_fields)
|
@@ -112,7 +119,7 @@ class JiraInfo:
|
|
112
119
|
filter_obj = self.jira.filter(filter_id)
|
113
120
|
jql = filter_obj.jql
|
114
121
|
elif jql is None:
|
115
|
-
default_jql_str = f'project =
|
122
|
+
default_jql_str = f'project = SSP'
|
116
123
|
try:
|
117
124
|
all_issues = {}
|
118
125
|
start_at = 0
|
@@ -233,7 +240,32 @@ class JiraInfo:
|
|
233
240
|
tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
|
234
241
|
test_end_time = value.get("测试完成时间(测试环境)")
|
235
242
|
content += f"> [{key + '-' + summary}]({url}) \n测试:{tester_user_id} \n测试完成时间:{test_end_time}\n\n "
|
236
|
-
content = f"### <font color=\"warning\">
|
243
|
+
content = f"### <font color=\"warning\"> 本周涉及后端需求如下,请分析并登记覆盖率报告,周会前填写</font> \n" + content
|
244
|
+
self.send_wecom_robot_message(webhook, content)
|
245
|
+
|
246
|
+
def registration_coverage_notice_every_day(self, webhook, datas):
|
247
|
+
"""
|
248
|
+
1、有后端开发工作量时才提示
|
249
|
+
2、并且把填写的链接附上
|
250
|
+
:return:
|
251
|
+
"""
|
252
|
+
content = ""
|
253
|
+
today = datetime.today().strftime('%Y-%m-%d')
|
254
|
+
for key, value in datas.items():
|
255
|
+
adjusted_test_completion_time = value.get("调整后测试完成时间(测试环境)")
|
256
|
+
test_end_time = value.get("测试完成时间(测试环境)") if adjusted_test_completion_time is None else adjusted_test_completion_time
|
257
|
+
test_end_text = '测试完成时间(测试环境)' if adjusted_test_completion_time is None else '调整后测试完成时间(测试环境)'
|
258
|
+
test_end_time_new = datetime.strptime(test_end_time, "%Y-%m-%d").strftime('%Y-%m-%d') if test_end_time is not None else None
|
259
|
+
summary = value.get("summary")
|
260
|
+
url = value.get("url")
|
261
|
+
backend_workload = value.get("后端工作量")
|
262
|
+
if test_end_time is not None and backend_workload is not None and backend_workload > 0 and test_end_time_new == today:
|
263
|
+
tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
|
264
|
+
content += f"> [{key + '-' + summary}]({url}) \n后端工作量:{backend_workload}\n测试人员:{tester_user_id} \n{test_end_text}:{test_end_time}\n\n "
|
265
|
+
if StringUtils.is_empty(content):
|
266
|
+
print(f"*** {today} 无涉及覆盖率登记需求,不发送通知 ***")
|
267
|
+
return
|
268
|
+
content = f"### <font color=\"warning\"> 涉及后端需求,测试完成后,请分析并登记覆盖率报告</font> \n" + content
|
237
269
|
self.send_wecom_robot_message(webhook, content)
|
238
270
|
|
239
271
|
def bug_not_closed_notice(self, webhook, datas):
|
@@ -252,6 +284,7 @@ class JiraInfo:
|
|
252
284
|
tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
|
253
285
|
content += f"> [{key + '-' + summary}]({url}) \n暂未修复bug数量:{len(not_fixed_dict)}\n测试:{tester_user_id} \n\n "
|
254
286
|
if StringUtils.is_empty(content):
|
287
|
+
print("无待修复bug..不发送通知")
|
255
288
|
return
|
256
289
|
content = f"### <font color=\"warning\"> 提醒本周上线需求暂未修复缺陷,请尽快确认</font> \n" + content
|
257
290
|
self.send_wecom_robot_message(webhook, content)
|
@@ -290,6 +323,8 @@ class JiraInfo:
|
|
290
323
|
:return:
|
291
324
|
"""
|
292
325
|
mobile_string = ""
|
326
|
+
if tester is None:
|
327
|
+
return None
|
293
328
|
for name in tester:
|
294
329
|
user_id = user_data.get(name, None)
|
295
330
|
mobile_string += f"<@{user_id}>"
|
@@ -370,17 +405,11 @@ class JiraInfo:
|
|
370
405
|
try:
|
371
406
|
response = requests.post(webhook_url, headers=headers, data=json.dumps(data))
|
372
407
|
response.raise_for_status()
|
408
|
+
print("发送企微消息成功!")
|
373
409
|
return response.json()
|
374
410
|
except requests.RequestException as e:
|
375
411
|
print(f"请求出错: {e}")
|
376
412
|
return None
|
377
413
|
except ValueError as e:
|
378
414
|
print(f"解析响应出错: {e}")
|
379
|
-
return None
|
380
|
-
|
381
|
-
|
382
|
-
# if __name__ == '__main__':
|
383
|
-
# # jirainfo.product_and_ui_acceptance_notice(webhook_url, result) # 发验收
|
384
|
-
# # jirainfo.bug_not_closed_notice(webhook_url, result) # bug未修复
|
385
|
-
# # jirainfo.registration_coverage_notice(webhook_url, result) # 覆盖率
|
386
|
-
# # jirainfo.modify_the_online_status_of_jira_notice(webhook_url, result) # 覆盖率
|
415
|
+
return None
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|