示例#1
0
def main(filename):

    mongo_db = mongodb_class.mongoDB('ext_system')

    if filename is None:
        filename = sys.argv[1]
    print filename

    xlsx_handler = XlsxHandler(filename)

    try:

        logging.log(logging.WARN, ">>> 2.")

        _str, _ncols = xlsx_handler.getXlsxColStr()
        print _str
        print _ncols
        # _table = "star_task"
        _table = xlsx_handler.getTableName()

        logging.log(logging.WARN, ">>> 3.")

        doList(xlsx_handler, mongo_db, _table, "APPEND", _ncols)
        print("%s- Done<%s>" % (time.ctime(), _table))
        logging.log(logging.WARN, "main: Done!")
        return True

    except Exception, e:
        print e
        # print("%s- Done[Nothing to do]" % time.ctime())
        logging.log(logging.WARN, "main: Nothing to do!")
        return False
示例#2
0
def main(filename):

    mongo_db = mongodb_class.mongoDB('ext_system')

    if filename is None:
        filename = sys.argv[1]
    print filename

    xlsx_handler = XlsxHandler(filename)

    try:

        logging.log(logging.WARN, ">>> 2.")

        _str, _ncols = xlsx_handler.getXlsxColStr()

        if _str not in TableName:
            print(">>> Err: [%s][%s] not be recognised" % (filename, _str))

        _table = TableName[_str].lower()

        logging.log(logging.WARN, ">>> 3.")

        doList(xlsx_handler, mongo_db, _table, "APPEND", _ncols, range(3))
        print("%s- Done" % time.ctime())
        logging.log(logging.WARN, "main: Done!")
        return True

    except Exception, e:
        print e
        # print("%s- Done[Nothing to do]" % time.ctime())
        logging.log(logging.WARN, "main: Nothing to do!")
        return False
示例#3
0
def main():

    filename = "D:\\shenwei\\R&D-MIS-DATABASE\\ext-system\\" + sys.argv[1]
    print filename
    xlsx_handler = xlsx_class.xlsx_handler(filename)
    try:

        _table, _op, _ncol, _rectype, _key = xlsx_handler.getXlsxHead()
        if _ncol is None or _ncol == 0:
            return True

        if _table is None:
            print("%s- Type invalid![None]" % time.ctime())
            return True

        _table = str(_table).lower()
        # print("...3")
        """mongoDB数据库
        """
        mongo_db = mongodb_class.mongoDB('ext_system')
        doList(xlsx_handler, mongo_db, _table, _op, _ncol, _key)

        # print("%s- Done" % time.ctime())
        return True

    except Exception, e:
        print e
        print("%s- Done[Nothing to do]" % time.ctime())
        return False
示例#4
0
 def __init__(self, date=None, landmark=None):
     self.personal = {}
     self.mongodb = mongodb_class.mongoDB(None)
     self.landmark = landmark
     if date is None:
         self.st_date = "2018-01-01"
         self.ed_date = "2018-12-31"
     else:
         self.st_date = date['st_date']
         self.ed_date = date['ed_date']
示例#5
0
def main(filename):

    mongo_db = mongodb_class.mongoDB('ext_system')

    if filename is None:
        filename = "D:\\shenwei\\R&D-MIS-DATABASE\\ext-system\\" + sys.argv[1]
    print filename

    xlsx_handler = xlsx_class.xlsx_handler(filename)

    try:

        _number_sheet = xlsx_handler.getSheetNumber()
        print("> Number of sheet: %d" % _number_sheet)

        for _n in range(_number_sheet):

            print("> Do sheet[%d]" % _n)
            xlsx_handler.setSheet(_n)

            _table, _op, _ncol, _rectype, _key = xlsx_handler.getXlsxHead()
            if _ncol is None or _ncol == 0:
                print(">Err< <%s>" % _table)
                return True

            if _table is None:
                print("%s- Type invalid![None]" % time.ctime())
                return True

            _table = str(_table).lower()

            print("> Creating [%s]" % _table)
            """mongoDB数据库
            """
            doList(xlsx_handler, mongo_db, _table, _op, _ncol, _key)

        print("%s- Done" % time.ctime())
        return True

    except Exception, e:
        print e
        print("%s- Done[Nothing to do]" % time.ctime())
        return False
示例#6
0
import win32gui
import win32con
import win32api
import sys
from win32con import *
import docx
from DataHandler import mongodb_class
import uuid

# from __future__ import unicode_literals
"""设置字符集
"""
reload(sys)
sys.setdefaultencoding('utf-8')

mongo_db = mongodb_class.mongoDB('PM_DAILY')


def getParam(text):

    _text = text.replace('-', "").replace(' ', "").replace('/', "").split(u"】")
    if len(_text[-1]) == 0:
        _text = _text[:-1]

    _params = []
    for _p in _text:
        if _p.find(u"【") == 0:
            __p = _p.split(u"【")[1:]
        else:
            __p = _p.split(u"【")
        for _i in __p:
示例#7
0
"""

from __future__ import unicode_literals

import networkx as nx
from networkx.readwrite import json_graph
from pyecharts import Graph

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

from DataHandler import mongodb_class
from pyecharts import Geo

mongo_db = mongodb_class.mongoDB('ext_system')

data = []
addr_data = {}

_rec = mongo_db.handler('trip_req', 'find', {u'外出类型': u'出差'})
for _r in _rec:
    _addr = _r['起止地点'].split(u'到')
    if len(_addr) == 1:
        _addr = _r['起止地点'].split(' ')
    if len(_addr) == 1:
        _addr = _r['起止地点'].split('-')
    if len(_addr) == 1:
        _addr = _r['起止地点'].split('_')
    if len(_addr) == 1:
        _addr = _r['起止地点'].split('~')