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
1e004421
Commit
1e004421
authored
Nov 15, 2017
by
Data-韩正辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整退款汇总的逻辑,将退款按照还款计划拆分与应还相加
parent
50bcd663
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
白条-每月到期本金利息.py
审计第二阶段/白条(非去哪儿)/白条-每月到期本金利息.py
+13
-7
No files found.
审计第二阶段/白条(非去哪儿)/白条-每月到期本金利息.py
View file @
1e004421
...
...
@@ -19,10 +19,11 @@ pd.options.mode.chained_assignment = None
# user_bt_repayment_plan,baitiao_order,fund_corp
# 注意事项:
# 出来的表为汇总表
#
# 笑脸直投应还本金会有140的差距,是由于下单后使用红包金额导致。查询代码:
# SELECT SUM(funding_loan_amount),SUM(real_loan_amount) FROM baitiao_order WHERE funding_corp_id=5 AND funding_loan_amount!=real_loan_amount;
file_path
=
u'E:/审计出表/非去哪儿白条-放款表(1月份-6月份)/'
engine_bt
=
create_engine
(
'mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.
3.201
:3306/audit?charset=utf8'
,
engine_bt
=
create_engine
(
'mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.
4.60
:3306/audit?charset=utf8'
,
echo
=
False
)
.
connect
()
def
bt_principle_interest
():
...
...
@@ -48,8 +49,8 @@ def bt_principle_interest():
sql_bt_refund
=
'''
SELECT
fc.fund_name 资金方,
YEAR (bo.
train_cancel
_at) 放款年,
MONTH (bo.
train_cancel
_at) 放款月,
YEAR (bo.
loan_paid
_at) 放款年,
MONTH (bo.
loan_paid
_at) 放款月,
YEAR (plan.deadline) 到期年,
MONTH (plan.deadline) 到期月,
sum(plan.principle) 客户应还本金,
...
...
@@ -59,7 +60,7 @@ def bt_principle_interest():
JOIN baitiao_audit.baitiao_order bo ON bo.ref_id = plan.ref_id
JOIN baitiao_audit.fund_corp fc ON fc.id = bo.funding_corp_id
WHERE
bo.is_active IN (-2) AND bo.funding_corp_id
= 1
bo.is_active IN (-2) AND bo.funding_corp_id
in (1,5) AND bo.train_cancel_at<'2017-11-01'
GROUP BY
1,2,3,4,5;
'''
...
...
@@ -75,7 +76,8 @@ def bt_principle_interest():
0 客户应还利息
from baitiao_audit.baitiao_order t1
join baitiao_audit.fund_corp fc ON fc.id = t1.funding_corp_id
where t1.baitiao_type=1;
where t1.baitiao_type=1
GROUP BY 1,2,3,4,5;
'''
df_bt
=
pd
.
read_sql
(
sql_bt
,
engine_bt
)
...
...
@@ -83,7 +85,11 @@ def bt_principle_interest():
df_cash
=
pd
.
read_sql
(
sql_cash_bt
,
engine_bt
)
df
=
pd
.
concat
([
df_bt
,
df_bt_refund
,
df_cash
],
ignore_index
=
True
)
df
.
to_excel
(
file_path
+
u'非去哪儿白条每月到期本金利息-V6.xlsx'
,
index
=
False
)
df
.
fillna
(
0
,
inplace
=
True
)
result
=
df
.
groupby
([
u'资金方'
,
u'放款年'
,
u'放款月'
,
u'到期年'
,
u'到期月'
])[
u'客户应还本金'
,
u'客户应还利息'
]
.
sum
()
.
reset_index
()
result
.
to_excel
(
file_path
+
u'非去哪儿白条每月到期本金利息-V7.xlsx'
,
index
=
False
)
df
.
to_excel
(
file_path
+
u'非去哪儿白条每月到期本金利息明细版本-V7.xlsx'
,
index
=
False
)
if
__name__
==
'__main__'
:
print
'--------main begin'
...
...
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