Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duizhang_tools
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data—王林芳
duizhang_tools
Commits
47d67d9b
Commit
47d67d9b
authored
Nov 10, 2017
by
Data-韩正辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10月份使用
parent
323cafe8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
人工控制-现金贷-客户实还表-加速测试版.py
人工控制/现金贷/人工控制-现金贷-客户实还表-加速测试版.py
+18
-18
人工控制-现金贷-还资金表-加速测试版.py
人工控制/现金贷/人工控制-现金贷-还资金表-加速测试版.py
+9
-9
No files found.
人工控制/现金贷/人工控制-现金贷-客户实还表-加速测试版.py
View file @
47d67d9b
...
...
@@ -13,7 +13,7 @@ pd.options.mode.chained_assignment = None
max_limit
=
800000
import
os
path
=
u'
d:/Users/Desktop/test
/'
path
=
u'
E:/审计出表/11月份开始使用表数据/11月份现金贷出表
/'
engine_xjd
=
create_engine
(
'mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.3.201:3306/?charset=utf8'
,
echo
=
False
)
.
connect
()
...
...
@@ -45,8 +45,8 @@ sql_repay_frr_2 = '''
sum(urp.principle) 'principle',
sum(urp.interest) 'interest'
FROM
all_back_0930
.user_repayment_plan urp
JOIN a
ll_back_0930
.loan_manifest lm ON lm.ref_id = urp.ref_id
FROM
new_transaction
.user_repayment_plan urp
JOIN a
udit
.loan_manifest lm ON lm.ref_id = urp.ref_id
WHERE lm.loan_paid_at>='
%
s' AND loan_paid_at<'
%
s'
AND urp.fund_code IN (210,270,310,320,410,430)
GROUP BY 1,2
...
...
@@ -63,7 +63,7 @@ sql_repay_frr_3 = '''
sum(frp.interest) 'interest'
FROM audit.funding_repayment_plan frp
JOIN a
ll_back_0930
.loan_manifest lm ON lm.ref_id = frp.ref_id
JOIN a
udit
.loan_manifest lm ON lm.ref_id = frp.ref_id
WHERE lm.loan_paid_at>='
%
s' AND loan_paid_at<'
%
s'
AND lm.funding_code NOT IN (210,270,310,320,410,430)
GROUP BY 1,2
...
...
@@ -75,10 +75,10 @@ SELECT t1.real_loan_id loan_id,date(lm.loan_paid_at) 'loan_paid_at',t1.ref_id,t1
t2.principle-t2.mitigate_principle 'repay_prin',t2.interest-t2.mitigate_interest 'repay_intes',
ifnull(t2.`service_fee`-t2.mitigate_service_fee,0) 'repay_fee',IFNULL(t2.`punish`-t2.mitigate_collection_relief, 0) 'repay_due',
t2.remain_income 'remain',t2.repay_channel,t6.order_id AS 'flow_no',t6.amount 'bank_amount',t1.service_fee 'service_fee',t1.required_repayment 'required_repayment'
FROM
audit_temp
.xjd_repay_plan_repay_record_ref t2
JOIN
all_back_0930
.user_repayment_plan t1 ON t1.id=t2.plan_id
JOIN
all_back_0930
.repay_record_online t6 ON t2.record_id=t6.id AND t2.repay_channel = t6.pay_approach
JOIN a
ll_back_0930
.loan_manifest lm ON lm.ref_id = t1.ref_id
FROM
new_transaction
.xjd_repay_plan_repay_record_ref t2
JOIN
new_transaction
.user_repayment_plan t1 ON t1.id=t2.plan_id
JOIN
new_transaction
.repay_record_online t6 ON t2.record_id=t6.id AND t2.repay_channel = t6.pay_approach
JOIN a
udit
.loan_manifest lm ON lm.ref_id = t1.ref_id
WHERE lm.loan_paid_at >= '
%
s' AND lm.loan_paid_at < '
%
s'
'''
...
...
@@ -88,10 +88,10 @@ SELECT t1.real_loan_id loan_id,date(lm.loan_paid_at) 'loan_paid_at',t1.ref_id,t1
t2.principle-t2.mitigate_principle 'repay_prin',t2.interest-t2.mitigate_interest 'repay_intes',
ifnull(t2.`service_fee`-t2.mitigate_service_fee,0) 'repay_fee',IFNULL(t2.`punish`-t2.mitigate_collection_relief, 0) 'repay_due',
t2.remain_income 'remain',t2.repay_channel,t6.business_flow 'flow_no',t6.income 'bank_amount',t1.service_fee 'service_fee',t1.required_repayment 'required_repayment'
FROM
audit_temp
.xjd_repay_plan_repay_record_ref t2
JOIN
all_back_0930
.`user_repayment_plan` t1 ON t1.id=t2.plan_id
JOIN
all_back_0930
.`offline_alipay_record` t6 ON t2.record_id=t6.id AND t2.repay_channel = 13
JOIN a
ll_back_0930
.loan_manifest lm ON lm.ref_id = t1.ref_id
FROM
new_transaction
.xjd_repay_plan_repay_record_ref t2
JOIN
new_transaction
.`user_repayment_plan` t1 ON t1.id=t2.plan_id
JOIN
new_transaction
.`offline_alipay_record` t6 ON t2.record_id=t6.id AND t2.repay_channel = 13
JOIN a
udit
.loan_manifest lm ON lm.ref_id = t1.ref_id
WHERE lm.loan_paid_at >= '
%
s' AND lm.loan_paid_at < '
%
s'
'''
...
...
@@ -101,10 +101,10 @@ SELECT t1.real_loan_id loan_id,date(lm.loan_paid_at) 'loan_paid_at',t1.ref_id,t1
t2.principle-t2.mitigate_principle 'repay_prin',t2.interest-t2.mitigate_interest 'repay_intes',
ifnull(t2.`service_fee`-t2.mitigate_service_fee,0) 'repay_fee',IFNULL(t2.`punish`-t2.mitigate_collection_relief, 0) 'repay_due',
t2.remain_income 'remain',t2.repay_channel,t6.transfer_amount 'bank_amount',t1.service_fee 'service_fee',t1.required_repayment 'required_repayment'
FROM
audit_temp
.xjd_repay_plan_repay_record_ref t2
JOIN
all_back_0930
.`user_repayment_plan` t1 ON t1.id=t2.plan_id
JOIN a
ll_back_0930
.loan_manifest lm ON lm.ref_id = t1.ref_id
JOIN
all_back_0930
.`offline_bank_repay_record` t6 ON t2.record_id=t6.id AND t2.repay_channel IN (14,15,16)
FROM
new_transaction
.xjd_repay_plan_repay_record_ref t2
JOIN
new_transaction
.`user_repayment_plan` t1 ON t1.id=t2.plan_id
JOIN a
udit
.loan_manifest lm ON lm.ref_id = t1.ref_id
JOIN
new_transaction
.`offline_bank_repay_record` t6 ON t2.record_id=t6.id AND t2.repay_channel IN (14,15,16)
WHERE lm.loan_paid_at >= '
%
s' AND lm.loan_paid_at < '
%
s'
'''
...
...
@@ -194,12 +194,12 @@ def handle_hk(year, month):
temp_list
=
temp
.
values
.
tolist
()
temp_list
.
insert
(
0
,
temp
.
columns
.
tolist
())
all_wb
.
new_sheet
(
str
(
int
(
i
/
max_limit
+
1
)),
data
=
temp_list
)
all_wb
.
save
(
path
+
u'人工控制-现金贷-客户实还表
-测试
(
%
d-
%02
d).xlsx'
%
(
start_time
.
year
,
start_time
.
month
))
all_wb
.
save
(
path
+
u'人工控制-现金贷-客户实还表(
%
d-
%02
d).xlsx'
%
(
start_time
.
year
,
start_time
.
month
))
if
__name__
==
'__main__'
:
year
=
[
2017
]
month
=
range
(
9
,
10
,
1
)
month
=
range
(
10
,
11
,
1
)
for
year
,
month
in
product
(
year
,
month
):
print
'____
%
d__
%
d'
%
(
year
,
month
)
...
...
人工控制/现金贷/人工控制-现金贷-还资金表-加速测试版.py
View file @
47d67d9b
...
...
@@ -13,7 +13,7 @@ sys.setdefaultencoding("utf-8")
pd
.
options
.
mode
.
chained_assignment
=
None
#此路径为服务器路径专用
path
=
u'E:/审计出表/
人工控制/现金贷-还资金方表-1010版本
/'
path
=
u'E:/审计出表/
11月份开始使用表数据/11月份现金贷出表
/'
# path = u'E:/审计出表/人工控制/现金贷-还资金方表-1010版本/'
engine_xjd
=
create_engine
(
'mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.3.201:3306/?charset=utf8'
,
echo
=
False
)
.
connect
()
...
...
@@ -37,7 +37,7 @@ def faster_sql_reader(sql):
sql_lm
=
'''
select ref_id,loan_id,funding_code,date(loan_paid_at) 'loan_paid_at',contract_term 'contract_term'
from a
ll_back_0831
.loan_manifest lm
from a
udit
.loan_manifest lm
where loan_paid_at>='
%
s' and loan_paid_at <'
%
s'
and is_active in (1, -2)
'''
...
...
@@ -56,8 +56,8 @@ sql_repay_frr_2 = '''
urp.term_no 'term_no',
date(urp.deadline) 'deadline',
urp.principle+urp.interest 'prin_intere'
from
all_back_0831
.user_repayment_plan urp
join a
ll_back_0831
.loan_manifest lm on lm.ref_id = urp.ref_id
from
new_transaction
.user_repayment_plan urp
join a
udit
.loan_manifest lm on lm.ref_id = urp.ref_id
where lm.loan_paid_at>='
%
s' and loan_paid_at<'
%
s'
and urp.fund_code in (210,270,310,320,410,430)
GROUP BY 1,2
...
...
@@ -72,7 +72,7 @@ sql_repay_frr_3 = '''
frp.interest+frp.principle 'prin_intere'
from audit.funding_repayment_plan frp
join a
ll_back_0831
.loan_manifest lm on lm.ref_id = frp.ref_id
join a
udit
.loan_manifest lm on lm.ref_id = frp.ref_id
WHERE lm.loan_paid_at>='
%
s' and loan_paid_at<'
%
s'
and lm.funding_code not in (210,270,310,320,410,430)
GROUP BY 1,2
...
...
@@ -89,8 +89,8 @@ sql_refund = '''
frr.flow_id 'flow_id',
frr.term_no 'term_no'
FROM
a
ll_back_0831
.funding_repayment_record frr
join a
ll_back_0831
.loan_manifest lm on lm.ref_id = frr.ref_id
a
udit
.funding_repayment_record frr
join a
udit
.loan_manifest lm on lm.ref_id = frr.ref_id
JOIN basic.funding_corp fc ON fc.funding_code = frr.funding_code
WHERE lm.loan_paid_at>='
%
s'
and lm.loan_paid_at <'
%
s'
...
...
@@ -185,7 +185,7 @@ def refund(year,month):
temp_list
=
temp
.
values
.
tolist
()
temp_list
.
insert
(
0
,
temp
.
columns
.
tolist
())
all_wb
.
new_sheet
(
str
(
int
(
i
/
max_limit
+
1
)),
data
=
temp_list
)
all_wb
.
save
(
path
+
u'人工控制-现金贷—还资金方表
-V4
(
%
d-
%02
d).xlsx'
%
(
start_time
.
year
,
start_time
.
month
))
all_wb
.
save
(
path
+
u'人工控制-现金贷—还资金方表(
%
d-
%02
d).xlsx'
%
(
start_time
.
year
,
start_time
.
month
))
# if len(df) > max_limit:
# for i in xrange(0, len(df), max_limit):
...
...
@@ -196,7 +196,7 @@ def refund(year,month):
if
__name__
==
'__main__'
:
year
=
[
2017
]
month
=
range
(
4
,
5
,
1
)
month
=
range
(
10
,
11
,
1
)
for
year
,
month
in
product
(
year
,
month
):
print
(
'-----------
%
s-
%
s begins'
)
%
(
year
,
month
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment