Example #1
0
def _getClients(dbconn, sf_param, desk_param):
    """ Get clients in both desk and sf
        args:
            dbconn: mongodb collection
            sfUser: user id of sales force
            deskUser: user id of desk
        return:
            a list of clients

    """
    # 先从 desk 中获取对应的客户信息
    desk_clients = dbconn[DESK_CASE_COL].distinct(
        'company',
        {
            'company': {'$exists':True},
            'fx_desk_userid': desk_param['user_id'],
            'fx_batch_id': desk_param['batch_id']
        }
    )

    # 再从 sf 中取用户信息
    sf_clients = dbconn[SEC_OP_COL].distinct(
        'Account.Name',
        {
            'Account.Name': {'$exists':True},
            'fx_sf_userid': sf_param['user_id'],
            'fx_batch_id': sf_param['batch_id']
        }
    )

    getOverlaps(desk_clients, sf_clients)

    return desk_clients
Example #2
0
ACS_PATH=os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(ACS_PATH)

from analyzers import mongoconn, factory, getOverlaps, parseSubType
from resultmgr import handleResults


if __name__ == "__main__":
    
    try:
        lista = ['11', '22', '33', '44']
        listb = ['11', '22', '33']
        listc = ['11', '22']

        getOverlaps (lista, listb, listc) 

        print lista

        conn = mongoconn.mongoConnection ('127.0.0.1', 27017, 'test')
        analyzer = factory.createAnalyzer (
            'satisfaction',
            {
                'db_conn': conn,
                'start_date': '2014-01-01', # 1420070400
                'end_date': '2015-07-01', # 1435708800
                'apps': {
                    'salesforce': {
                        'user_id': '00000000000051TEST', # '00528000000ImzzAAC',
                        #'batch_id': 'yASCUj'
                    },