Exemplo n.º 1
0
class FeatureProcessError(ServerError):
    status = ResponseCode.FEATURE_PROCESS_ERROR
    message = ResponseCode.message(status)
    log_message = message

    def __init__(self, message=None):
        if message:
            self.message = message

        super(FeatureProcessError, self).__init__(self.message)
Exemplo n.º 2
0
    def get(self, request, client_code, proposer_id, *args, **kwargs):
        data = {
            'status': ResponseCode.SUCCESS,
            'message': ResponseCode.message(ResponseCode.SUCCESS)
        }
        self.client_code = client_code

        logger.info('Model pre granting, client_code=%s, proposer_id=%s',
                    client_code, proposer_id)

        try:
            # check client_code is not valid
            if not self.verify():
                raise UserIdentityError()

            # 用proposer_id 获取
            model = get_pre_grant_model(proposer_id)
            pre_grant_amount = model.grant()

            data.update({
                'res_data': {
                    'result': 1,
                    'result_message': u'业务处理成功',
                    'pre_grant_amount': pre_grant_amount
                }
            })
        except (UserIdentityError, ) as e:
            logger.error(e.message)

            data.update({'status': e.status, 'message': e.message})
        except Exception, e:
            logger.error(e)

            data.update({
                'status': ResponseCode.FAILED,
                'message': ResponseCode.message(ResponseCode.FAILED)
            })
Exemplo n.º 3
0
def audit_task(apply_id, base_data, process_apply_id):
    data = {
        cons.RESPONSE_REQUEST_STATUS:
        ResponseCode.FEATURE_SUCCESS,
        cons.RESPONSE_REQUEST_MESSAGE:
        ResponseCode.message(ResponseCode.FEATURE_SUCCESS)
    }
    try:
        logger.info(
            '\n===========Streams in ASYNC mission control center,Collecting feature now=========='
        )
        logger.info("base_data: %s" % base_data)
        ret_data = mission_control(base_data)
        data.update({
            'client_code': base_data.get('client_code', None),
            'apply_id': apply_id.get('apply_id', None),
            'ret_msg': ret_data,
            'process_apply_id': process_apply_id
        })
    except ServerError as e:
        data = {
            'apply_id': apply_id.get('apply_id', None),
            cons.RESPONSE_REQUEST_STATUS: e.status,
            cons.RESPONSE_REQUEST_MESSAGE: e.message,
            'process_apply_id': process_apply_id
        }
    except Exception as e:
        import traceback
        traceback.print_exc()
        data = {
            'apply_id': apply_id.get('apply_id', None),
            cons.RESPONSE_REQUEST_STATUS: ResponseCode.FAILED,
            cons.RESPONSE_REQUEST_MESSAGE: e.message,
            'process_apply_id': process_apply_id
        }
    finally:
        callback_url = base_data['callback_url']
        headers = {"Content-type": "application/json; charset=utf-8"}
        logger.info("%s, %s" % (callback_url, data))
        post_data = json.dumps(data)
        response = requests.post(callback_url, headers=headers, data=post_data)
        logger.info('Results have already arrived, reply %s', response.content)
Exemplo n.º 4
0
class ClientCodeMissing(ServerError):
    status = ResponseCode.MISSING_CLIENT_CODE
    message = ResponseCode.message(status)
Exemplo n.º 5
0
class AsyncCallInterfaceError(ServerError):
    status = ResponseCode.ASYNC_CALL_INTERFACE_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 6
0
class CommonFeatureConfigError(ServerError):
    status = ResponseCode.COMMON_FEATURE_CONFIG_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 7
0
class FeatureConfigError(ServerError):
    status = ResponseCode.WRONG_FEATURE_CONFIG
    message = ResponseCode.message(status)
Exemplo n.º 8
0
class ClientCodeInexistence(ServerError):
    status = ResponseCode.UNAVAILABLE_CLIENT_CODE
    message = ResponseCode.message(status)
Exemplo n.º 9
0
class HandleInitializeFailed(ServerError):
    status = ResponseCode.HANDLE_INIT_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 10
0
class JunkmanInitializeFailed(ServerError):
    status = ResponseCode.JUNKMAN_INIT_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 11
0
class OriginDataGetError(ServerError):
    status = ResponseCode.ORIGIN_DATA_GET_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 12
0
class OriginDataGetParmsMiss(ServerError):
    status = ResponseCode.ORIGIN_DATA_GET_PARMS_MISS
    message = ResponseCode.message(status)
Exemplo n.º 13
0
class RequestTypeError(AttributeError):
    status = ResponseCode.REQUEST_TYPE_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 14
0
class NoPortraitData(ServerError):
    status = ResponseCode.NO_PORTRAIT_DATA
    message = ResponseCode.message(status)
Exemplo n.º 15
0
class ServerBusy(ServerError):
    status = ResponseCode.SERVER_BUSY
    message = ResponseCode.message(status)
Exemplo n.º 16
0
class FeatureNameUnfound(ServerError):
    status = ResponseCode.FEATURE_UNFOUND
    message = ResponseCode.message(status)
Exemplo n.º 17
0
class DataIdentityUnfound(ServerError):
    status = ResponseCode.DATAIDENTITY_UNFOUND
    message = ResponseCode.message(status)
Exemplo n.º 18
0
class AsyncCallInterfaceTimeout(ServerError):
    status = ResponseCode.ASYNC_CALL_INTERFACE_TIMEOUT
    message = ResponseCode.message(status)
Exemplo n.º 19
0
class JunkmanWorkError(ServerError):
    status = ResponseCode.JUNKMAN_WORK_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 20
0
class InterfaceInfoTableConfigError(ServerError):
    status = ResponseCode.INTERFACE_INFO_TABLE_CONFIG_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 21
0
class HandleWorkError(ServerError):
    status = ResponseCode.HANDLE_WORK_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 22
0
class MissingManageType(ServerError):
    status = ResponseCode.MISSING_JUDGE_TYPE
    message = ResponseCode.message(status)
Exemplo n.º 23
0
class FeatureProcessError(ServerError):
    status = ResponseCode.FEATURE_PROCESS_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 24
0
class JudgeInitializeFailed(ServerError):
    status = ResponseCode.JUDGE_INIT_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 25
0
class RelevanceFeatureConfigError(ServerError):
    status = ResponseCode.RELEVANCE_FEATURE_CONFIG_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 26
0
class JudgeWorkError(ServerError):
    status = ResponseCode.JUDGE_WORK_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 27
0
class ShuntFeatureConfigError(ServerError):
    status = ResponseCode.SHUNT_FEATURE_CONFIG_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 28
0
class JudgeReturenError(ServerError):
    status = ResponseCode.JUDGE_RET_ERROR
    message = ResponseCode.message(status)
Exemplo n.º 29
0
class DoingAsyncCallInterface(ServerError):
    status = ResponseCode.DOING_ASYNC_CALL_INTERFACE
    message = ResponseCode.message(status)
    data_identify = ''
Exemplo n.º 30
0
class ProposerIdMissing(ServerError):
    status = ResponseCode.MISSING_PROPOSER_ID
    message = ResponseCode.message(status)