delete from xyqb.loan_application_manifest_history
where loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1);
update xyqb.loan_application_manifest_history
set user_id=(select id from xyqb_user.user where phone_no =$phone_no),
loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1),
loan_received_at='$date',
product_id=(select distinct(product_id) from risk_control.product_strategy_dispatcher where funding_corp_id=$fund_id),
loan_paid_at='$date'
where loan_application_history_id =111112222233333;
update xyqb.page_state_info
set state='AuditedSuccState'
where loan_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1);
mysql -h"192.168.4.$ip"-p"3306"-u"qa"-p"qatest"<<EOF
use xyqb;
update xyqb.loan_application_history
set xyqb.loan_application_history.progress=15
where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1;
update xyqb.loan_application_manifest_history
set loan_paid_at='$date'
where loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1);
update xyqb.page_state_info
set state='ViewRepayState'
where loan_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1);
update payment_center.bank_card t set t.user_id=(select id from payment_center.user where phone_no =$phone_no) where t.user_id=111112222233333;
update payment_center.bind_card_order t set t.user_id=(select id from payment_center.user where phone_no =$phone_no) where t.user_id=111112222233333;
update payment_center.card_bind_info t set t.user_id=(select id from payment_center.user where phone_no =$phone_no),bank_card_id=(select id from payment_center.bank_card where card_no=6227000010912341234 and user_id=(select id from payment_center.user where phone_no =$phone_no)) where t.user_id=111112222233333;
mysql -h"192.168.4.$ip"-p"3306"-u"qa"-p"qatest"<<EOF
use xyqb;
update xyqb.repayment_plan
set repayment_status=3
where loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1) and repayment_status=0;
update xyqb.loan_application_history
set progress=16, is_active=0
where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1;
mysql -h"192.168.4.$ip"-p"3306"-u"qa"-p"qatest"<<EOF
use xyqb;
update xyqb.repayment_plan
set repayment_status=3
where loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1) and repayment_status=0 limit 1;