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
efccf9d9
Commit
efccf9d9
authored
Nov 10, 2017
by
Data-韩正辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loan_contract需要时时进行修改
parent
47d67d9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
人工控制-现金贷-放款表-加速测试版.py
人工控制/现金贷/人工控制-现金贷-放款表-加速测试版.py
+10
-9
No files found.
人工控制/现金贷/人工控制-现金贷-放款表-加速测试版.py
View file @
efccf9d9
...
...
@@ -25,9 +25,10 @@ import os
# loan_manifest.is_active in (1,-2)
# 需要先进行数据的获取,需要时间较长,sql_repay_all中xrd.repaid_at同样需要修改
# sql_contract_no需要每月进行修改
path
=
u'1020_files/'
path
=
u'E:/审计出表/
非去哪儿白条-客户实还表-1023版
/'
path
=
u'E:/审计出表/
11月份开始使用表数据/11月份现金贷出表
/'
engine_xjd
=
create_engine
(
'mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.3.201:3306/audit?charset=utf8'
,
echo
=
False
)
.
connect
()
...
...
@@ -48,7 +49,7 @@ def faster_sql_reader(sql):
sql_fund
=
'''
select frp.ref_id,frp.term_no 'term_no',date(frp.deadline) 'deadline',frp.principle+ifnull(frp.interest,0) 'prin_interes'
from audit.funding_repayment_plan frp
where frp.deadline >= '2017-
01
-01'
where frp.deadline >= '2017-
10
-01'
'''
df_fund
=
faster_sql_reader
(
sql_fund
)
df_fund
.
rename
(
columns
=
{
'term_no'
:
u'应还期数'
,
'deadline'
:
u'应还资金方时间'
,
'prin_interes'
:
u'应还资金方本息'
},
inplace
=
True
)
...
...
@@ -58,13 +59,13 @@ df_fund.rename(columns={'term_no':u'应还期数','deadline':u'应还资金方
#此部分不需要进行修改
sql_contract_no
=
'''
select ref_id,contract_no
from basic.loan_class_contract_
1002
lco
from basic.loan_class_contract_
201711
lco
'''
#10月05日修改为basic.loan_class_contract_1002
df_contract_no
=
faster_sql_reader
(
sql_contract_no
)
sql_fund_name
=
'''
sql_fund_name
=
'''
select funding_code,name '资金方'
from basic.funding_corp
'''
...
...
@@ -81,9 +82,9 @@ def mc_pay(year, month):
urp.term_no 'term_no',
sum(xrprrr.principle-IFNULL(xrprrr.mitigate_principle,0)+xrprrr.interest-IFNULL(xrprrr.mitigate_interest,0)) 'principle_interes',
sum(xrprrr.service_fee-IFNULL(xrprrr.mitigate_service_fee,0)) 'service_fee'
from
audit_temp.xjd_repay_plan_repay_record_ref_0831
xrprrr
join
all_back_0831
.user_repayment_plan urp on xrprrr.plan_id = urp.id
join a
ll_back_0831
.loan_manifest lm on lm.ref_id = urp.ref_id
from
new_transaction.xjd_repay_plan_repay_record_ref
xrprrr
join
new_transaction
.user_repayment_plan urp on xrprrr.plan_id = urp.id
join a
udit
.loan_manifest lm on lm.ref_id = urp.ref_id
where lm.loan_paid_at>='
%
s' and lm.loan_paid_at<'
%
s'
group by 1,2
'''
%
(
start_time
,
end_time
)
...
...
@@ -168,7 +169,7 @@ def mc_pay(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 len(df_pay) > max_limit:
...
...
@@ -180,7 +181,7 @@ def mc_pay(year, month):
if
__name__
==
'__main__'
:
year
=
[
2017
]
month
=
range
(
1
,
2
,
1
)
month
=
range
(
1
0
,
11
,
1
)
for
year
,
month
in
product
(
year
,
month
):
mc_pay
(
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