Commit 7eb2ba68 authored by qa_quantgroup's avatar qa_quantgroup

修改pushloanprogress脚本

parent 51037df0
......@@ -46,9 +46,9 @@ 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);
update risk_control.review_history
set progress=0
where phone_no=$phone_no
#update risk_control.review_history
#set progress=0
#where phone_no=$phone_no
EOF
echo "done!!! $date"
......@@ -54,7 +54,7 @@ function activate()
mysql $mysqld xyqb -e "set names utf8;${insert_consume}"
#授信用户表
uuid1='69891c47-e8c7-4b96-8a8d-'${phone_no}
uuid1='928ba526-29f1-4ef8-8bb8-'${phone_no}
insert_spider="INSERT INTO user ("phone_no", "password", "registered_from", "uuid", "enable", "created_at", "updated_at")VALUES (${phone_no}, '4c00961baa8857e558c10db0e58c003e', 222, '${uuid1}', 1, '$date_now', '$date_now')"
mysql $mysqld spider_center -e "set names utf8;${insert_spider}"
#授权表增加数据
......@@ -64,7 +64,7 @@ function activate()
mysql $mysqld spider_center -e "set names utf8;${insert_authorization}"
#mall用户表
uuid2='3a324e8b-78dc-45a7-bf16-'${phone_no}
uuid2='928ba526-29f1-4ef8-8bb8-'${phone_no}
insert_mall="INSERT INTO user("phone_no", "password", "registered_from", "uuid", "enable", "created_at", "updated_at")VALUES ( ${phone_no}, '318e235d3e52648b236faa3f748000d5', '214', '${uuid2}', '1', '$date_now', '$date_now')"
mysql $mysqld mall -e "set names utf8;${insert_mall}"
select_mall_user_id="select id FROM user WHERE phone_no=${phone_no}"
......
#!/bin/bash
ip=$1
phone_no=$2
bill_num=3
bill_num_a=0
PORT=$3
USERNAME="qa"
PASSWORD="qatest"
mysqld="-h${ip} -P${PORT} -u${USERNAME} -p${PASSWORD}"
date_now=`date "+%Y-%m-%d %H:%M:%S"`
function baitiao_order()
{
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ] ; then
echo "请输入11位手机号 !"
else
#生成订单
#白条订单表增加数据
select_user_id="SELECT id from user where user.phone_no=${phone_no}"
xyqb_user_id=`mysql -N $mysqld xyqb_user -e "set names utf8;${select_user_id}"`
# echo $select_user_id
order_no='xyqb'${phone_no}
order="INSERT INTO baitiao_order( "user_id", "merchant_id", "order_no", "order_name", "order_amount", "repay_term", "status", "created_at", "updated_at", "baitiao_order_type") VALUES (${xyqb_user_id}, 7, '${order_no}', '信用钱包订单', 2499.000000, 1,1, '$date_now', '$date_now', 0)"
mysql $mysqld xyqb -e "set names utf8;${order}"
# echo " order=$order"
select_order_id="SELECT id from baitiao_order where user_id=${xyqb_user_id}"
baitiao_order_id=`mysql -N $mysqld xyqb -e "set names utf8;${select_order_id}"`
#echo "select_order_id=$select_order_id"
# echo "baitiao_order_id=$baitiao_order_id"
insert_fund="INSERT INTO baitiao_fund_order ( "order_id", "status", "rate", "refund_status", "start_interest_date", "fund_id", "finance_record_id", "created_at", "updated_at") VALUES ( $baitiao_order_id, 0, 0.060200, 0, NULL, '3', NULL, '$date_now', '$date_now')"
# echo "insert_fund=$insert_fund"
mysql $mysqld xyqb -e "set names utf8;${insert_fund}"
#白条还款计划表增加数据
repayment_plan1="INSERT INTO baitiao_bill_repayment_plan ("bill_id", "user_id", "user_phone", "order_id", "order_no", "order_name", "order_time", "merchant_id", "order_amount", "deadline", "term_no", "contract_term", "rate", "principal", "interest", "penalty_interest", "red_packet_amount", "collection_reduction", "repay_amount", "repay_amount_compute_time", "lock_time", "repaid_at", "repayment_received_at", "repayment_status", "pay_center_order_no", "enable", "created_at", "updated_at") VALUES (NULL, ${xyqb_user_id}, '${phone_no}', ${baitiao_order_id},'信用钱包订单', '手机', '$date_now', 7, 2499.000000, '2018-01-20 23:59:59', 1, 3, 0.030000, 833.000000, 74.970000, 0.000000, 0.000000, 0.000000, 907.970000, '$date_now', NULL, '$date_now', NULL, '0', NULL, 1, '$date_now', '$date_now')"
mysql $mysqld xyqb -e "set names utf8;${repayment_plan1}"
# echo "plan1=$repayment_plan1"
repayment_plan2="INSERT INTO baitiao_bill_repayment_plan ("bill_id", "user_id", "user_phone", "order_id", "order_no", "order_name", "order_time", "merchant_id", "order_amount", "deadline", "term_no", "contract_term", "rate", "principal", "interest", "penalty_interest", "red_packet_amount", "collection_reduction", "repay_amount", "repay_amount_compute_time", "lock_time", "repaid_at", "repayment_received_at", "repayment_status", "pay_center_order_no", "enable", "created_at", "updated_at") VALUES (NULL, ${xyqb_user_id}, '${phone_no}', ${baitiao_order_id}, '信用钱包订单', '手机','$date_now', 7, 2499.000000, '2018-02-20 23:59:59', 2, 3, 0.030000, 833.000000, 74.970000, 0.000000, 0.000000, 0.000000, 907.970000, '$date_now', NULL, '$date_now',NULL, '0', NULL, 1,'$date_now', '$date_now')"
mysql $mysqld xyqb -e "set names utf8;${repayment_plan2}"
#echo "plan2=$repayment_plan2"
repayment_plan3="INSERT INTO baitiao_bill_repayment_plan ("bill_id", "user_id", "user_phone", "order_id", "order_no", "order_name", "order_time", "merchant_id", "order_amount", "deadline", "term_no", "contract_term", "rate", "principal", "interest", "penalty_interest", "red_packet_amount", "collection_reduction", "repay_amount", "repay_amount_compute_time", "lock_time", "repaid_at", "repayment_received_at", "repayment_status", "pay_center_order_no", "enable", "created_at", "updated_at") VALUES (NULL, ${xyqb_user_id}, ${phone_no}, ${baitiao_order_id}, '信用钱包订单', '手机', '$date_now', 7, '2499.000000', '2018-03-20 23:59:59', '3', '3', '0.030000', '833.000000', '74.970000', '0.000000', '0.000000', '0.000000', '907.970000', '$date_now', NULL,'$date_now', NULL, '0', NULL, '1', '$date_now','$date_now')"
mysql $mysqld xyqb -e "set names utf8;${repayment_plan3}"
#echo "plan3=$repayment_plan3"
#白条额度表变化表增加数据
consume_seq1='ABCD201708051511458'${phone_no}
consume="INSERT INTO baitiao_consume_history("user_id", "order_id", "order_amount", "remaining_amount", "consume_type", "consume_seq", "created_at", "updated_at") VALUES(${xyqb_user_id}, ${baitiao_order_id}, '2499.00', '13501.00', '1', '${consume_seq1}', '$date_now','$date_now')"
# echo "consume=$consume"
mysql $mysqld xyqb -e "set names utf8;${consume}"
fi
}
baitiao_order $ip $phone_no
......@@ -3,10 +3,12 @@ ip=$1
phone_no=$2
PORT=$3
namespace=$4
progress_id=$5
USERNAME="qa"
PASSWORD="qatest"
DBNAME="xyqb"
TABLENAME="loan_application_history"
TABLENAME2="quota_credit"
DBNAME1="xyqb_user"
TABLENAME1="user"
mysqld="-h${ip} -P${PORT} -u${USERNAME} -p${PASSWORD}"
......@@ -18,6 +20,7 @@ if [ -z "$namespace" ];then
cash_domain=$ip:7037
fi
function pushloanprogress(){
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ]
......@@ -28,7 +31,7 @@ function pushloanprogress(){
#查询userID
select_sql="select id from ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME1} -e "${select_sql}"`
#cho "user_id=$user_id"
#echo "user_id=$user_id"
#查找loanid
loanid="select id from ${TABLENAME} where user_id=${user_id} order by id desc limit 1"
......@@ -37,55 +40,26 @@ function pushloanprogress(){
#查询订单状态
progressid="select progress from ${TABLENAME} where user_id=${user_id} order by id desc limit 1"
progress_id=`mysql -N $mysqld ${DBNAME} -e "${progressid}"`
echo "progress=$progress_id"
progressid_id=`mysql -N $mysqld ${DBNAME} -e "${progressid}"`
#echo "progress=$progressid_id"
#查询授信订单号
order_no="select order_no from ${TABLENAME2} where user_id=${user_id} order by id desc limit 1"
applyno=`mysql -N $mysqld ${DBNAME} -e "${order_no}"`
#echo "applyno=$applyno"
#push订单状态
#终审中
if [ $progress_id -eq 7 ]; then
curl -d "loanId=${loan_id}&loanProgress=FINAL_SCREENING" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#终审拒绝
elif [ $progress_id -eq 8 ]; then
curl -d "loanId=${loan_id}&loanProgress=FINAL_SCREENING_REJECT" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#未通过初筛
elif [ $progress_id -eq 19 ]; then
curl -d "loanId=${loan_id}&loanProgress=FILTERING_DECLINED" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#借款清单生成完成
elif [ $progress_id -eq 9 ]; then
curl -d "loanId=${loan_id}&loanProgress=LOAN_APPLICATION_MANIFEST_COMPLETE" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#等待资金方放款
elif [ $progress_id -eq 20 ]; then
curl -d "loanId=${loan_id}&loanProgress=WAITING_FUND" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#查看还款计划
elif [ $progress_id -eq 15 ]; then
curl -d "loanId=${loan_id}&loanProgress=CHECK_REPAYMENT_PLAN" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#马上金融放款失败
elif [ $progress_id -eq 23 ]; then
curl -d "loanId=${loan_id}&loanProgress=FINAL_FUNDED_APPROVAL_FAIL" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
#借款完成
elif [ $progress_id -eq 16 ]; then
curl -d "loanId=${loan_id}&loanProgress=LOAN_COMPLETE" "http://${cash_domain}/test/loanMq/one"
if [ -z "$applyno" ];then
echo "未找到applyno,请检查授信订单号"
break
else
echo "progress=$progress_id,订单状态不对"
echo "loan_id=$loan_id"
echo "progress=$progress_id"
curl -d "loanid=${loan_id}&progress=${progress_id}&applyNo=${applyno}" "http://${cash_domain}/test/loanMq/one"
echo "推送成功 $date"
fi
break
fi
}
......
......@@ -62,11 +62,12 @@ user_authorization_insert="INSERT INTO spider_center.user_authorization ( auth_t
VALUES
(3, now(), NULL, ${spider_center_user_id}, 1),
(0, now(), NULL, ${spider_center_user_id}, 1),
(14, now(), NULL, ${spider_center_user_id}, 1),
(7, now(), NULL, ${spider_center_user_id}, 1);"
mysql $mysql3 -e"set names utf8; ${user_authorization_insert}"
fi
if [[ ${user_authorization_type[*]} =~ "3" || ${user_authorization_type[*]} =~ "0" && $user_authorization_status != "1" ]];then
mysql $mysql3 -e"update spider_center.user_authorization set auth_status=1 where user_id=${spider_center_user_id} and auth_type in (0,3,7);"
mysql $mysql3 -e"update spider_center.user_authorization set auth_status=1 where user_id=${spider_center_user_id} and auth_type in (0,3,7,14);"
fi
echo "运营商、芝麻信用验证通过"
......@@ -63,11 +63,12 @@ user_authorization_insert="INSERT INTO spider_center.user_authorization ( auth_t
VALUES
(3, now(), NULL, ${spider_center_user_id}, 1),
(0, now(), NULL, ${spider_center_user_id}, 1),
(14, now(), NULL, ${spider_center_user_id}, 1),
(7, now(), NULL, ${spider_center_user_id}, 1);"
mysql $mysql3 -e"set names utf8; ${user_authorization_insert}"
fi
if [[ ${user_authorization_type[*]} =~ "3" || ${user_authorization_type[*]} =~ "0" && $user_authorization_status != "1" ]];then
mysql $mysql3 -e"update spider_center.user_authorization set auth_status=1 where user_id=${spider_center_user_id} and auth_type in (0,3,7);"
mysql $mysql3 -e"update spider_center.user_authorization set auth_status=1 where user_id=${spider_center_user_id} and auth_type in (0,3,7,14);"
fi
#xyqb.loan_application_history插入一条贷款记录
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment