Exemple #1
0
def main():

    """MySQL数据库
    """
    mysql_db = mysql_hdr.SqlService(
        MySQLdb.connect(host="47.93.192.232", user="******", passwd="sw64419" ,db="nebula", charset='utf8'))

    group_name = {"FAST": u'云平台研发组',
                  "HUBBLE": u'大数据研发组',
                  "CPSJ": u'产品设计组',
                  "ROOOT": u'系统组',
                  "TESTCENTER": u'测试组'}
    for source in ['FAST', 'HUBBLE', 'CPSJ', 'ROOOT', 'TESTCENTER']:
        """mongoDB数据库
        """
        mongo_db = mongodb_class.mongoDB(source)
        load_worklog(mysql_db, mongo_db, group_name[source], source)
Exemple #2
0
"""
reload(sys)
sys.setdefaultencoding('utf-8')

import xlrd
import time
from datetime import datetime
import mysql_hdr

db = MySQLdb.connect(host="172.16.60.2",
                     user="******",
                     passwd="53ZkAuoDVc8nsrVG",
                     db="nebula",
                     charset='utf8')
# db = MySQLdb.connect(host="47.93.192.232",user="******",passwd="sw64419",db="nebula",charset='utf8')
MySQLhdr = mysql_hdr.SqlService(db)

RowName = [
    'KQ_NAME',
    'KQ_PART',
    'KQ_USERID',
    'KQ_DATE',
    'KQ_WORKTIME',
    'KQ_AM',
    'KQ_AM_STATE',
    'KQ_PM',
    'KQ_PM_STATE',
    'KQ_REF',
    'KQ_GROUP',
]
ColList = [0, 1, 2, 5, 6, 7, 8, 9, 10, 15, 3]
Exemple #3
0
from __future__ import unicode_literals

import mongodb_class
import MySQLdb
import mysql_hdr
import types
import datetime

mongo_db = mongodb_class.mongoDB()
db = MySQLdb.connect(host="172.16.60.2",
                     user="******",
                     passwd="53ZkAuoDVc8nsrVG",
                     db="nebula",
                     charset='utf8')
mysql_db = mysql_hdr.SqlService(db)
"""项目状态:"""
pj_state = [u'在建', u'验收', u'交付', u'发布', u'运维']

pj_list = ['GZ', 'JX', 'SCGA']
rdm_list = ['RDM', 'TESTCENTER']
pd_list = ['CPSJ', 'FAST', 'HUBBLE', 'ROOOT']


def get_trip_count(st_date, ed_date):
    """
    获取差旅记录个数
    :return:
    """

    # 连接ext_system数据库
Exemple #4
0
if __name__ == '__main__':

    global __test

    __test = True
    _test_case = 3

    db = MySQLdb.connect(host="47.93.192.232",
                         user="******",
                         passwd="sw64419",
                         db="nebula",
                         charset='utf8')
    # db = MySQLdb.connect(host="172.16.101.117", user="******", passwd="123456", db="nebula", charset='utf8')
    cur = db.cursor()
    my_sql = mysql_hdr.SqlService(db)

    if _test_case == 1:
        fn1, fn2, lvl, kv = getPersonalPlanQ(cur)
        for _k in kv:
            print(u'%s: %s => %s' % (_k, kv[_k][0], kv[_k][1]))
    elif _test_case == 2:
        _data = []
        _data.append([[10, 6, 4, 2, 1, 0, 0, 0, 0], "#8f8f8f", "^", u'等待'])
        _data.append([[0, 4, 6, 5, 3, 2, 1, 0, 0], "#f8f8f8", "o", u"执行中"])
        _data.append([[0, 0, 0, 3, 4, 4, 3, 1, 0], "#f8f8f8", "v", u"测试中"])
        _data.append([[0, 0, 0, 0, 2, 3, 6, 9, 10], "#f8f8f8", "*", u"完成"])

        _color = ['g', 'y', 'r', 'k']
        _sql = u'select name from jira_landmark_t where pj_id="FAST"'
        _res = my_sql.do(_sql)
Exemple #5
0
def main():
    """连接数据库"""
    db = MySQLdb.connect(host="47.93.192.232",
                         user="******",
                         passwd="sw64419",
                         db="nebula",
                         charset='utf8')
    my_sql = mysql_hdr.SqlService(db)

    my_jira = jira_handler('FAST')
    """
    _info = my_jira.get_pj_info()
    print(u"项目名称:%s,负责人:%s" % (_info['pj_name'], _info['pj_manager']))
    """
    """获取项目版本信息
    """
    versions = my_jira.get_versions()
    _versions = sorted(versions)
    task_link = {}
    _version = {}
    for _v in _versions:
        if u"3.0 " not in u"%s" % _v:
            continue
        if not _version.has_key(u"%s" % _v):
            _version[u"%s" % _v] = {}
        kv, kv_link, _task_link = my_jira.scan_issue(
            '2017-12-1',
            [u'story', u'epic', u'improvement', u'New Feature', u'改进', u'新功能'],
            version=u"%s" % _v)
        task_link.update(_task_link)
        if not _version[u"%s" % _v].has_key(u"issues"):
            _version[u"%s" % _v][u"issues"] = {}
        _version[u"%s" % _v][u"startDate"] = versions[_v][u"startDate"]
        _version[u"%s" % _v][u"releaseDate"] = versions[_v][u"releaseDate"]
        _version[u"%s" % _v][u"issues"][u"key"] = kv
        _version[u"%s" % _v][u"issues"][u"link"] = kv_link
    """获取DB的里程碑信息
    """
    _sql = u'select name,start_date,release_date from jira_landmark_t where pj_id="FAST"'
    _res = my_sql.do(_sql)
    _db_rec = {}
    for _r in _res:
        _db_rec[_r[0]] = {'start_date': _r[1], 'release_date': _r[2]}

    for _v in sorted(_version, key=lambda a: a.split(u'(')[1]):
        print u"里程碑:%s" % _v, \
            u"\t startDate: %s" % versions[_v][u"startDate"],\
            u"\t releaseDate: %s" % versions[_v][u"releaseDate"]
        """同步里程碑信息
        """
        if _v in _db_rec:
            if versions[_v][u"startDate"] != _db_rec[_v]['start_date']:
                _sql = u'update jira_landmark_t set start_date="%s",updated_at=now() ' \
                       u'where pj_id="FAST" and name="%s"' % (_v, versions[_v][u"startDate"])
                print _sql
                my_sql.insert(_sql)
            if versions[_v][u"releaseDate"] != _db_rec[_v]['release_date']:
                _sql = u'update jira_landmark_t set release_date="%s",updated_at=now() ' \
                       u'where pj_id="FAST" and name="%s"' % (_v, versions[_v][u"releaseDate"])
                print _sql
                my_sql.insert(_sql)
        else:
            _sql = u'insert into jira_landmark_t(pj_id,name,start_date,release_date,created_at,updated_at) ' \
                   u'values("FAST","%s","%s","%s",now(),now())' % \
                   (_v, versions[_v][u"startDate"], versions[_v][u"releaseDate"])
            print _sql
            my_sql.insert(_sql)

        for _key in _version[_v][u"issues"][u"key"]:
            print(u"[类型:%s]: %d(个)" %
                  (_key, _version[_v][u"issues"][u"key"][_key]))
            for __v in _version[_v][u"issues"][u"link"][_key]:
                print u'\t状态:%s' % __v
                for __story in _version[_v][u"issues"][u"link"][_key][__v]:
                    """里程碑里所有story
                    """
                    print u"\t\t- story:",
                    my_jira.set_issue_by_name(__story)
                    _kv = my_jira.show_issue()
                    into_db(my_sql, my_jira, _kv)
                    if task_link.has_key(__story):
                        for _task in task_link[__story]:
                            print u"\t\t\t 任务: ",
                            my_jira.set_issue_by_name(_task)
                            _kv = my_jira.show_issue()
                            my_jira.sync_worklog()
                            into_db(my_sql, my_jira, _kv)
                            _link = my_jira.get_link()
                            for _l in _link:
                                for __l in _link[_l]:
                                    if __l == __story:
                                        continue
                                    print "\t\t\t\t",
                                    my_jira.set_issue_by_name(__l)
                                    _kv = my_jira.show_issue()
                                    my_jira.sync_worklog()
                                    into_db(my_sql, my_jira, _kv)