Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
fc05f494
Commit
fc05f494
authored
Jan 12, 2021
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户列表
parent
ccd6f5f1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
24 deletions
+133
-24
default_template_params.py
app/config/default_template_params.py
+10
-2
customer.py
app/controller/customer.py
+41
-0
base.py
app/model/base.py
+7
-2
version1.py
app/router/version1.py
+2
-1
customer.py
app/service/customer.py
+40
-0
monthReportV2.1.html
app/templates/v2/monthReportV2.1.html
+31
-18
jinjia2html_v2.py
app/utils/jinjia2html_v2.py
+2
-1
No files found.
app/config/default_template_params.py
View file @
fc05f494
...
...
@@ -48,7 +48,7 @@ hold_default_template = {
'logo': img_transfer(template_folder + '/v2/img/logo.png'),
'brand_name': '小飞象',
'logo_display': 'block',
'brand_name': 'block',
'brand_name
_display
': 'block',
'cover_back': img_transfer(template_folder + '/v2/img/cover-back.png'),
#
# 'scene': img_transfer(template_folder + '/v2/img/scene.png'),
...
...
@@ -96,7 +96,7 @@ diagnose_default_template = {
'logo': img_transfer(template_folder + '/v2/img/logo.png'),
'brand_name': '小飞象',
'logo_display': 'block',
'brand_name': 'block',
'brand_name
_display
': 'block',
'cover_back': img_transfer(template_folder + '/v2/img/cover-back.png'),
#
# 'scene': img_transfer(template_folder + '/v2/img/scene.png'),
...
...
@@ -107,6 +107,7 @@ diagnose_default_template = {
hold_default_data = {
"customer_name": "王晶",
"valueSex": 1,
"year_month": "2020-12",
"month": "12",
"start_date": "2020-07-17",
...
...
@@ -314,6 +315,9 @@ hold_default_data = {
"index_volatility": "41.32",
"index_max_withdrawal": "9.98",
"index_sharpe_ratio": "0.26",
"plan_cost_of_investment": "160.00",
"target_annualised_return": "49.15",
"target_max_withdrawal": "4.75",
"group_nav_info": [
{
"fund_name": "丹羿步步高德兴1号",
...
...
@@ -412,6 +416,7 @@ hold_default_data = {
diagnose_default_data = {
"customer_name": "王晶 ",
"valueSex": 1,
"year_month": "2020-12",
"month": "12",
"start_date": "2020-07-17",
...
...
@@ -684,6 +689,9 @@ diagnose_default_data = {
"index_volatility": "41.32",
"index_max_withdrawal": "9.98",
"index_sharpe_ratio": "0.26",
"plan_cost_of_investment": "160.00",
"target_annualised_return": "49.15",
"target_max_withdrawal": "4.75",
"group_nav_info": [
{
"fund_name": "丹羿步步高德兴1号",
app/controller/customer.py
0 → 100644
View file @
fc05f494
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : customer.py
# @Time : 2021/1/11 下午5:50
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
from
flask
import
request
from
flask_restful
import
Resource
,
reqparse
from
app.api.engine
import
redis
from
app.service.customer
import
get_customer_list
class
CustomerList
(
Resource
):
""""""
def
__init__
(
self
):
"""."""
token
=
request
.
headers
.
get
(
'Authorization'
,
''
)
token
=
's:sid:'
+
token
.
split
(
' '
)[
1
]
ifa_id
=
redis
.
get
(
token
)
if
not
ifa_id
:
return
{
"code"
:
'9005'
,
"message"
:
"请登录"
,
"attributes"
:
[]}
self
.
ifa_id
=
ifa_id
.
decode
()
.
replace
(
'
\'
'
,
''
)
self
.
parser
=
reqparse
.
RequestParser
()
def
get
(
self
):
"""获取客户列表分页数据."""
self
.
parser
.
add_argument
(
'name'
,
type
=
str
,
required
=
False
,
help
=
'客户名'
)
self
.
parser
.
add_argument
(
'pageNumber'
,
type
=
int
,
required
=
True
)
self
.
parser
.
add_argument
(
'pageSize'
,
type
=
int
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
args
[
'ifa_id'
]
=
self
.
ifa_id
data
=
get_customer_list
(
args
)
resp
=
{
"statusCode"
:
"0000"
,
"message"
:
"成功"
,
"attributes"
:
data
}
return
resp
\ No newline at end of file
app/model/base.py
View file @
fc05f494
...
...
@@ -18,7 +18,12 @@ class BaseModel():
def
__init__
(
self
):
pass
def
to_dict
(
self
):
return
{
c
.
name
:
int
(
getattr
(
self
,
c
.
name
)
.
timestamp
())
if
isinstance
(
getattr
(
self
,
c
.
name
),
datetime
.
datetime
)
else
getattr
(
self
,
c
.
name
)
for
c
in
self
.
__table__
.
columns
}
def
to_dict
(
self
,
allow_field
=
None
):
all_field
=
[
r
.
name
for
r
in
self
.
__table__
.
columns
]
if
allow_field
:
allow_field
=
set
(
allow_field
)
&
set
(
allow_field
)
else
:
allow_field
=
all_field
return
{
c
:
int
(
getattr
(
self
,
c
)
.
timestamp
())
if
isinstance
(
getattr
(
self
,
c
),
datetime
.
datetime
)
else
getattr
(
self
,
c
)
for
c
in
allow_field
}
app/router/version1.py
View file @
fc05f494
...
...
@@ -6,7 +6,7 @@
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
from
app.controller.customer
import
CustomerList
from
app.controller.report
import
*
from
app.controller.template_manage
import
*
...
...
@@ -15,4 +15,5 @@ def add_route(api):
api
.
add_resource
(
ReportHandlers
,
'/api/fund_report/report'
)
api
.
add_resource
(
TemplateManage
,
'/api/template_manage'
)
api
.
add_resource
(
TemplateList
,
'/api/template_list'
)
api
.
add_resource
(
CustomerList
,
'/api/customer_list'
)
app/service/customer.py
0 → 100644
View file @
fc05f494
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : customer.py
# @Time : 2021/1/11 下午5:53
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
from
sqlalchemy
import
and_
from
app.api.engine
import
TAMP_SQL
,
tamp_diagnose_app_engine
from
app.model.tamp_diagnose_app
import
Customer
,
IfaCustomer
def
get_customer_list
(
args
):
""""""
pageNumber
=
args
[
'pageNumber'
]
pageSize
=
args
[
'pageSize'
]
offset
=
(
pageNumber
-
1
)
*
pageSize
name
=
args
.
get
(
'name'
)
ifa_id
=
args
.
get
(
'ifa_id'
)
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_session
=
tamp_diagnose_app
.
session
customer_id_list
=
tamp_diagnose_session
.
query
(
IfaCustomer
.
customer_id
)
.
filter
(
and_
(
IfaCustomer
.
ifa_id
==
ifa_id
,
IfaCustomer
.
delete_tag
==
0
,
))
.
all
()
customer_id_list
=
[
r
[
0
]
for
r
in
customer_id_list
]
conditions
=
[
Customer
.
id
.
in_
(
customer_id_list
),
Customer
.
delete_tag
==
0
,
]
if
name
:
conditions
.
append
(
Customer
.
customer_name
.
like
(
'
%
'
+
name
+
'
%
'
))
customer_list
=
tamp_diagnose_session
.
query
(
Customer
)
.
filter
(
and_
(
*
conditions
))
.
all
()
allow_field
=
[
'id'
,
'customer_name'
,
'valueSex'
,
'phone'
]
return
[
r
.
to_dict
(
allow_field
)
for
r
in
customer_list
]
app/templates/v2/monthReportV2.1.html
View file @
fc05f494
...
...
@@ -942,7 +942,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"cover_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -961,8 +962,8 @@
</div>
<img
class=
"cover_img"
src=
{{red_rect}}
>
<div
class=
"cover_title_text dcell"
>
资产
<br>
存续报告
{{cover_title1}}
<br>
{{cover_title2}}
<div
class=
"cover_date"
>
<div
class=
"cover_time"
>
{{year_month}}
...
...
@@ -1024,7 +1025,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1304,7 +1306,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1338,9 +1341,9 @@
<th>
目标最大回撤(%)
</th>
</tr>
<tr>
<td>
{{group_result["cost_of_investment"]}}
</td>
<td>
--
</td>
<td>
--
</td>
<td>
{{group_result["
plan_
cost_of_investment"]}}
</td>
<td>
{{group_result["target_annualised_return"]}}
</td>
<td>
{{group_result["target_max_withdrawal"]}}
</td>
</tr>
</table>
</div>
...
...
@@ -1529,7 +1532,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1665,7 +1669,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1699,7 +1704,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1721,7 +1727,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1780,7 +1787,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1823,7 +1831,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -1919,7 +1928,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -2063,7 +2073,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -2086,7 +2097,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
@@ -2163,7 +2175,8 @@
</div>
<div
class=
"dcell"
>
<div
class=
"page_text"
>
{{brand_name}}
{{brand_name}}
<br>
工作室
</div>
</div>
</div>
...
...
app/utils/jinjia2html_v2.py
View file @
fc05f494
...
...
@@ -312,5 +312,6 @@ if __name__ == '__main__':
start
=
time
.
time
()
dt
=
DataIntegrate
(
ifa_id
=
'USER_INFO15917850824287'
,
customer_id
=
'6716613802534121472'
,
type
=
1
)
data
=
dt
.
get_template_data
()
dt
.
render_data
()
# dt.render_data()
print
(
'耗时{}秒'
.
format
(
round
(
time
.
time
()
-
start
,
2
)))
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