代码拉取完成,页面将自动刷新
同步操作将从 欧文/loadjiradata2excel 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- coding: utf-8 -*-
from jira import JIRA
from KDissue import *
from MailSender import *
from ExcelDeal import KDExcel
usemail = True
MailList = ['sunxue@kaidi.com','huaxiaobin@kaidi.com','zhangweijie@kaidi.com','hesongjiang@kaidi.com','gejunning@kaidi.com','liuweijun@kaidi.com','zhouyeqing@kaidi.com','yangzhengguang@kaidi.com','zongyue@kaidi.com','liuzunpeng@kaidi.com','wangdianren@kaidi.com','wangwenli@kaidi.com','dongjianbo@kaidi.com','shaopeng@kaidi.com','liuweidong@kaidi.com','luchangming@kaidi.com','chengleilei@kaidi.com','yejunchen@kaidi.com','kanrenfeng@kaidi.com','xuzhiqi@kaidi.com','fanzhengqing@kaidi.com','huangxiaolong@kaidi.com','niewei@kaidi.com','wangyulong@kaidi.com','lixu@kaidi.com','shiyitao@kaidi.com','yaobutang@kaidi.com','gezhennan@kaidi.com','cuifang@kaidi.com','qianwenhuan@kaidi.com','xuzhiming@kaidi.com','zhouzhu@kaidi.com','lijie@kaidi.com','xiahongtao@kaidi.com','xujun@kaidi.com','yuanshuai@kaidi.com','guofayong@kaidi.com','taopengfei@kaidi.com','kongyuan@kaidi.com','lijiayun@kaidi.com','guofei@kaidi.com','lihao@kaidi.com','wangbeilei@kaidi.com','zhumeixiang@kaidi.com','zhuangwenxu@kaidi.com','wujian@kaidi.com','liujingjing@kaidi.com','maxiangxiang@kaidi.com','wujixiong@kaidi.com','liuqilin@kaidi.com','yaoxin@kaidi.com','wangziming@kaidi.com','wukai@kaidi.com','yangwenfeng@kaidi.com','sunfulai@kaidi.com','zengchongmin@kaidi.com','huanghuailong@kaidi.com']
DevelopMail = ['yaobutang@kaidi.com','zhuangwenxu@kaidi.com','gezhennan@kaidi.com','xuzhiming@kaidi.com','yuanshuai@kaidi.com','lihao@kaidi.com','wangbeilei@kaidi.com','wujian@kaidi.com','liuqilin@kaidi.com','yaoxin@kaidi.com','wangziming@kaidi.com','wukai@kaidi.com','yangwenfeng@kaidi.com','sunfulai@kaidi.com','zengchongmin@kaidi.com','huanghuailong@kaidi.com']
#登录jira
def login_jira(username,password):
jira = JIRA("http://192.168.1.21:8080",basic_auth=(username,password))
return jira
def searchIssues(jql, max_results=1000):
''' Search issues
@param jql: JQL, str
@param max_results: max results, int, default 100
@return issues: result, list
'''
try:
issues = jira.search_issues(jql, maxResults=max_results)
return issues
except Exception as e:
print(e)
def SearchbyJQL(jql):
_list = []
issues = searchIssues(jql)
for issue in issues:
# print('{0}: {1} '.format(issue.key, issue.fields.status))
_issue = JiraIssue()
_content = []
_key = str(issue.key)
_type = str(issue.fields.customfield_10700)
_create_time = str(issue.fields.created)
_version = str(issue.fields.customfield_10701 if issue.fields.customfield_10701 != None else ('' if len(issue.fields.versions) == 0 else (issue.fields.versions[0].name if len(issue.fields.versions) == 1 else issue.fields.versions[len(issue.fields.versions) - 1].name)))
_discrip = str(issue.fields.summary )
_discrip = str(_discrip + '\n' + str(issue.fields.description) if issue.fields.description != None else '')
_ctreater = str(issue.fields.creator)
_rootcause = str(issue.fields.customfield_10600)
_fix_discrip = str(issue.fields.customfield_10702)
_update_time = str(issue.fields.updated)
_fixVersion = str('' if len(issue.fields.fixVersions) == 0 else (issue.fields.fixVersions[0].name if len(issue.fields.fixVersions) == 1 else issue.fields.fixVersions[len(issue.fields.fixVersions) - 1].name))
_howtocheck = str(issue.fields.customfield_10703)
_handler = str(issue.fields.assignee)
_checkdiscrip = str(issue.fields.customfield_10704)
_status = str(issue.fields.status)
_check_time = str(_update_time if _status == u'已关闭' else None)
# print(_check_time)
_updater = str(issue.fields.reporter if _status == u'已关闭' else None)
_result = str(issue.fields.resolution)
_content.append(_key)
_content.append(_type)
_content.append(_create_time[0:10] if _create_time != None else None)
_content.append(_version)
_content.append(_discrip)
_content.append(_ctreater)
_content.append(_rootcause)
_content.append(_fix_discrip)
_content.append(_update_time[0:10] if _update_time != None else None)
_content.append(_fixVersion)
_content.append(_howtocheck)
_content.append(_checkdiscrip)
_content.append(_handler)
_content.append(_updater)
_content.append(_result)
_content.append(_check_time[0:10] if _check_time != None else None)
_content.append(_status)
_issue.insertParam(_content)
_list.append(_issue)
# print('****************************************************************')
return _list
if __name__ == '__main__':
jira = login_jira('wukai','wkwkwk1314')
allfields = jira.fields()
#nameMap = {field['name']:field['id'] for field in allfields}
#for field in allfields:
# print('{0}: {1}'.format(field['name'],field['id']))
iswin = False if "win" not in str(sys.platform) else True
excelhandle = None
if iswin:
excelhandle = KDExcel("..\\KdIssueCollect.xlsx")
else:
excelhandle = KDExcel("../KdIssueCollect.xlsx")
if usemail:
mailsender = EmailSender()
#************************TeachUI begin***************************************
# search project 01
jql = '''
project = 10003 AND component = TeachUI AND project = TSXT
'''
m_list = SearchbyJQL(jql)
# search project 02
jql = '''
project = 10100 AND component = TeachUI AND project = TSXT02
'''
m_list = m_list + SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "TeachUI")
#**************************TeachUI end*************************************
m_list = []
#************************ManageUnit(管理平台) begin***************************************
# search project 01
jql = '''
project = 10003 AND component = "ManageUnit(管理平台)" AND project = TSXT
'''
m_list = SearchbyJQL(jql)
# search project 02
jql = '''
project = 10100 AND component = "ManageUnit(管理平台)" AND project = TSXT02
'''
m_list = m_list + SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "ManageUnit")
#**************************ManageUnit(管理平台) end*************************************
m_list = []
#************************实时交互控制系统 begin***************************************
# search project 01
jql = '''
project = 10003 AND component = "实时交互控制系统" AND project = TSXT
'''
m_list = SearchbyJQL(jql)
# search project 02
jql = '''
project = 10100 AND component = "实时交互控制系统" AND project = TSXT02
'''
m_list = m_list + SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "BoardCtrl")
#**************************实时交互控制系统 end*************************************
m_list = []
#************************Kinematics(运动学) begin***************************************
# search project 01
jql = '''
project = 10003 AND component = "Kinematics(运动学)" AND project = TSXT
'''
m_list = SearchbyJQL(jql)
# search project 02
jql = '''
project = 10100 AND component = "Kinematics(运动学)" AND project = TSXT02
'''
m_list = m_list + SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "Kinematics")
#**************************Kinematics(运动学) end*************************************
m_list = []
#************************Servo(伺服) begin***************************************
# search project 02
jql = '''
project = 10100 AND component = "Servo(伺服)" AND project = TSXT02
'''
m_list = SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "Servo")
#**************************Servo(伺服) end*************************************
m_list = []
#************************Electron(电子) begin***************************************
# search project 02
jql = '''
project = 10100 AND component = "Electron(电子)" AND project = TSXT02
'''
m_list = SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "Electron")
#**************************Electron(电子) end*************************************
m_list = []
#************************Machine(机械) begin***************************************
# search project 02
jql = '''
project = 10100 AND component = "Machine(机械)" AND project = TSXT02
'''
m_list = SearchbyJQL(jql)
#TODO send the _list to excel deal model
excelhandle.dealData(m_list, "Machine")
#**************************Machine(机械) end*************************************
developList = excelhandle.developIssueList
excelhandle.close()
if usemail:
if iswin:
mailsender.SendMail(MailList, str(u'凯迪智能装备事业部开发问题汇总-' + excelhandle.date), 'Hi All \n 今天Jira问题汇总已采集,参见附件 \n 本邮件由系统自动推送,勿需回复 \n 以上 \n 谢谢', ["..\\KdIssueCollect.xlsx"])
else:
mailsender.SendMail(MailList, str(u'凯迪智能装备事业部开发问题汇总-' + excelhandle.date), 'Hi All \n 今天Jira问题汇总已采集,参见附件 \n 本邮件由系统自动推送,勿需回复 \n 以上 \n 谢谢', ["../KdIssueCollect.xlsx"])
if len(developList) > 0:
if iswin:
excelhandle = KDExcel("..\\developIssue.xlsx")
else:
excelhandle = KDExcel("../developIssue.xlsx")
excelhandle.dealData(developList, "Develop")
excelhandle.close()
if iswin:
mailsender.SendMail(DevelopMail, str(u'开发问题汇总-' + excelhandle.date), 'Hi All \n 今天Jira开发内建问题汇总已采集,参见附件 \n 本邮件由系统自动推送,勿需回复 \n 以上 \n 谢谢', ["..\\developIssue.xlsx"])
else:
mailsender.SendMail(DevelopMail, str(u'开发问题汇总-' + excelhandle.date), 'Hi All \n 今天Jira开发内建问题汇总已采集,参见附件 \n 本邮件由系统自动推送,勿需回复 \n 以上 \n 谢谢', ["../developIssue.xlsx"])
mailsender.QuitMail()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。