Exemplo n.º 1
0
    converters = {}
    insertData = []
    errorData = []
    total = 0
    complete = 0
    today = date.today()
    # today = datetime.strptime('05/02/2020', "%d/%m/%Y").date()
    day = today.day
    month = today.month
    year = today.year
    fileName = "Lawsuit report.xlsx"
    sep = ';'
    logDbName = "LO_Input_result_" + str(year) + str(month)

    if day == 1:
        mongodb.create_db(DB_NAME=logDbName)
        mongodbresult = Mongodb(logDbName, WFF_ENV=wff_env)
    else:
        mongodbresult = Mongodb(logDbName, WFF_ENV=wff_env)

    ftpLocalUrl = common.getDownloadFolder() + fileName

    try:
        sys.argv[1]
        importLogId = str(sys.argv[1])
        importLogInfo = mongodb.getOne(MONGO_COLLECTION=common.getSubUser(
            subUserType, 'Import'),
                                       WHERE={'_id': ObjectId(sys.argv[1])})
    except Exception as SysArgvError:
        if not os.path.isfile(ftpLocalUrl):
            sys.exit()
Exemplo n.º 2
0
        sys.exit()

    todayString = today.strftime("%d/%m/%Y")
    starttime = int(
        time.mktime(
            time.strptime(str(todayString + " 00:00:00"),
                          "%d/%m/%Y %H:%M:%S")))
    endtime = int(
        time.mktime(
            time.strptime(str(todayString + " 23:59:59"),
                          "%d/%m/%Y %H:%M:%S")))

    collectionName = 'LO_input_report_' + str(year) + str(month)

    if day == 1:
        mongodb.create_db(collectionName)

    mongodbReport = Mongodb(collectionName)

    lnjc05InfoFull = mongodb.get(
        MONGO_COLLECTION=common.getSubUser(subUserType, 'LNJC05'))
    lnjc05ColName = 'LNJC05_' + str(year) + str(month) + str(day)
    mongodbReport.create_col(COL_NAME=lnjc05ColName)
    mongodbReport.remove_document(MONGO_COLLECTION=lnjc05ColName)
    mongodbReport.batch_insert(MONGO_COLLECTION=lnjc05ColName,
                               insert_data=lnjc05InfoFull)

    listOfAccFull = mongodb.get(MONGO_COLLECTION=common.getSubUser(
        subUserType, 'List_of_account_in_collection'))
    listOfAccColName = 'List_of_account_in_collection_' + str(year) + str(
        month) + str(day)