##消费地图白名单,phone本身就是md5加密的
map_white_sql="""
select phone from finance_offline_feature.del_20220627 
"""
##贷前贷中用户,未加密
feature_user_sql="""
select phone_no,uuid from xyqb_user.user order by rand() limit {num}
"""

##通过金融uuid拿到身份证号，然后再拿到该身份证号的所有金融userid
finance_uuid_idno_userids_sql="""
select user_id from xyqb_user.user_detail where id_no in (
select b.id_no  from xyqb_user.user  a 
join xyqb_user.user_detail b on a.id=b.user_id
where a.uuid='{}')
"""

###VCC现有固定额度
vcc_fixed_amount_sql="""
select fixed_amount,used_amount from vcc_quota.user_quota_record
 where user_id in {} and status in (1,2)
"""
##VCC现有临时额度
vcc_temporary_amount_sql="""
SELECT user_id,amount from vcc_quota.user_quota_package where id= (SELECT max(id) FROM vcc_quota.user_quota_package
 where  user_id in {} and status in (1,2) GROUP BY user_id) 
"""


###现金分期当前在贷
cash_used_amount_sql="""
SELECT
  repay.user_id,
  sum( repay.required_repayment ) required_repayment 
FROM
  xyqb.repayment_plan repay
  INNER JOIN xyqb.loan_application_manifest_history loan ON loan.id = repay.loan_application_manifest_history_id 
WHERE
  repay.repayment_status <> 3 
  AND loan.transaction_status IN ( 2, 5 ) 
  and repay.user_id in {}
  -- AND date(deadline)>=date(now())
GROUP BY
  repay.user_id
"""

##
base_user_info_sql="""
select id from xyqb_user.user where uuid='{}'
"""