Exemple #1
0
# 数据写入数据库
def write():
    try:
        lists = []
        month = datetime.datetime.now().strftime("%Y%m")
        table = "bomc.cboss_interface_data_" + month
        for func in exce():
            lists.append(func)
        sql, vauleList = ora.batchInsertSql(table, lists, "backTable")
        ora.batchExec("backTable", sql, vauleList)
    except Exception as error:
        logging.error(error)
        ora.dataRollback()
    else:
        ora.dataCommit()


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    try:
        config = Config("EsbInterFaceDate")
        staticConfig = config.getStaticConfig()
        logging = config.getLogging()
        ora = config.getDataSource()
        conDict = staticConfig.getKeyDict()
        write()
    except Exception as error:
        logging.error(error)
        sys.exit(1)
    else:
        sys.exit(0)
Exemple #2
0
                      t.exe_error = :exeError,
                      t.exe_code = :exeCode
                  where opr_number = :oprNumber
                  """
            sql = ora.strFormat(sql)
            ora.batchExec("backTable", sql, dictVaule)
        except Exception as error:
            logging.error(error)
            ora.dataRollback()
        else:
            ora.dataCommit()


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    config = Config("AccountCancellationSearch")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    try:
        dataSearchFunc = dataSearch()
        data(dataSearchFunc)
    except Exception as error:
        logging.error(error)
        sys.exit(1)
    else:
        sys.exit(0)
    finally:
        ora.dataClose()
Exemple #3
0
        vso = 'so4'
        vsoDb = 'crmd'
    else:
        logging.info("地市编号有误")
        raise Exception("地市编号有误")
    return vso, vsoDb


def regionExecute():
    # 循环11个地市
    for region in range(570, 581):
        # 存放用户
        vso = None
        # 存放数据源名
        vsoDb = None

        # 根据地市编号返回用户名和数据库连接名
        user, vsoDb = regionCodes(region)
        OAOFeedback(user, vsoDb, region)
    del vso, vsoDb


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    config = Config("OAOFeedback")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    regionExecute()
Exemple #4
0
        except Exception as error:
            logging.error(error)
            ora.dataRollback()
        else:
            ora.dataCommit()

    for func in OaoFeedback():
        try:
            if len(func) == 0:
                return
            sql, dataList = ora.batchInsertSql(table, func, "backTable")
            logging.info(sql)
            logging.info(dataList)
            ora.batchInsert("backTable", sql, dataList)
        except Exception as error:
            logging.error(error)
            ora.dataRollback()
        else:
            ora.dataCommit()


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    config = Config("OrderSyncStateInsert")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    pdbLink = "backTable"
    execFunc()
    except Exception as errors:
        raise errors


def exceFunc():
    try:
        reprocessingHis()
        syncErrData = reprocessing()
        if len(syncErrData) > 0:
            reprocessingNow(syncErrData)
    except Exception as errors:
        raise errors


if __name__ == '__main__':
    try:
        # NumCardStartSync
        config = Config("NumCardStartSync")
        staticConfig = config.getStaticConfig()
        logging = config.getLogging()
        ora = config.getDataSource()
        conDict = staticConfig.getKeyDict()
        exceFunc()
    except Exception as error:
        logging.error(error)
        sys.exit(1)
    else:
        logging.info("程序结束")
        sys.exit(0)
Exemple #6
0
            raise Exception("没有配置对应的TABDB!!!")
        boeCbossOaoJhsbZiyu(vso, vsoDb, region)
    except Exception as error:
        raise error
    finally:
        del vso, vsoDb


@timeLog("主程序")
def execFunc():
    try:
        regionExecute()
    except Exception as error:
        logging.error("程序异常结束:")
        logging.error(error)
        sys.exit(1)
    else:
        logging.info("程序执行结束")
        sys.exit(0)


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    config = Config("BOE_CBOSS_OAO_JHSB_ZIYU_571")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    pdbLink = "backTable"
    execFunc()
        # 接口数据入库
        tableName = "cboss.example_overload_" + datetime.datetime.now(
        ).strftime("%Y%m")
        insertSql, insertDate = ora.batchInsertSql(tableName, datas)
        ora.batchInsert("cboss", insertSql, insertDate)
    except Exception as error:
        ora.dataRollback()
        raise error
    else:
        ora.dataCommit()


if __name__ == '__main__':

    try:
        # 程序配置在cboss.python_config_cboss表中
        config = Config("DefaultDataSourceCongfig")
        staticConfig = config.getStaticConfig()
        logging = config.getLogging()
        ora = config.getDataSource()
        conDict = staticConfig.getKeyDict()

        # 调用主程序
        dataWarehousing()
    except Exception as error:
        logging.error(error)
        sys.exit(1)
    else:
        logging.info("程序结束")
        sys.exit(0)
            raise Exception("没有配置对应的TABDB!!!")
        boeCbossOaoJZjyuZjyu(vso, vsoDb, region)
    except Exception as error:
        raise error
    finally:
        del vso, vsoDb


@timeLog("主程序")
def execFunc():
    try:
        regionExecute()
    except Exception as error:
        logging.error("程序异常结束:")
        logging.error(error)
        sys.exit(1)
    else:
        logging.info("程序执行结束")
        sys.exit(0)


if __name__ == '__main__':
    # 程序配置在cboss.python_config_cboss表中
    config = Config("BOE_CBOSS_OAO_ZJYU_ZJYU_579")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    pdbLink = "backTable"
    execFunc()
Exemple #9
0
                deleteFile = path + "/" + file
                logging.info(file)
                if reCompile.search(file):
                    reprocessing(path, file)
            except Exception as error:
                logging.error(error)

    except Exception as error:
        logging.error(error)
    finally:
        pass


if __name__ == '__main__':
    try:
        config = Config("OaoFileReprocessing")
        staticConfig = config.getStaticConfig()
        logging = config.getLogging()
        ora = config.getDataSource()
        conDict = staticConfig.getKeyDict()
        begin = time.time()
        dateTime_p = datetime.datetime.now()
        ftp = None
        for i in range(0, connCount):
            try:
                ftp = ftpconnect(ftpIp, ftpPort, ftpUser, ftpPassword)
            except Exception as error:
                if i == 4:
                    logging.error("连接ftp失败!!")
                    raise error
                else:
                # 判断是不是目标文件
                if reCompile.search(file) is None:
                    continue
                # 文件下载到本地
                fileDown(locaDir, file)
                # 文件解析入库
                fileAnalysis(locaDir, file)
                # 文件转移历史目录
                fileUp(locaDir, filePathHis, file, filePath)
            except Exception as error:
                logging.error("文件解析失败:" + file)
            else:
                logging.info("文件解析成功:" + file)
            finally:
                pass
                # myFile.close()
                # ftp.cwd(filePath)

    except Exception as error:
        logging.error(error)


if __name__ == '__main__':
    config = Config("FTPFILE_DOCUMENT_TORAGE")
    staticConfig = config.getStaticConfig()
    logging = config.getLogging()
    ora = config.getDataSource()
    conDict = staticConfig.getKeyDict()
    ftp = ftpConn()
    ftpFileExec()