Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c6e7d735
Commit
c6e7d735
authored
Mar 30, 2020
by
黄静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hj
parent
8397642f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
calc_result/IndexComputerFile.py
+16
-13
No files found.
calc_result/IndexComputerFile.py
View file @
c6e7d735
# coding:utf-8
# coding:utf-8
#计算风控结果
#计算风控结果
import
re
import
re
class
IndexComputer
:
class
IndexComputer
:
funs
=
[]
#公式集合
funs
=
[]
#公式集合
...
@@ -15,9 +14,10 @@ class IndexComputer:
...
@@ -15,9 +14,10 @@ class IndexComputer:
Y
=
[]
Y
=
[]
V
=
{}
V
=
{}
S
=
[]
S
=
[]
# 1.给indexItem.FactorsValue赋测试值
for
factorkey
in
indexItem
.
FactorsValue
:
for
factorkey
in
indexItem
.
FactorsValue
:
tempval
=
indexItem
.
FactorsValue
[
factorkey
]
tempval
=
indexItem
.
FactorsValue
[
factorkey
]
tempval
=
str
(
tempval
)
tempval
=
str
(
tempval
)
if
indexItem
.
FactorsValue
[
factorkey
]
is
None
:
if
indexItem
.
FactorsValue
[
factorkey
]
is
None
:
print
(
"is None"
)
print
(
"is None"
)
return
{
"status_key"
:
0
,
"status_value"
:
"normal"
}
return
{
"status_key"
:
0
,
"status_value"
:
"normal"
}
...
@@ -32,16 +32,17 @@ class IndexComputer:
...
@@ -32,16 +32,17 @@ class IndexComputer:
i
=
i
+
1
i
=
i
+
1
S
=
sorted
(
S
,
key
=
lambda
i
:
len
(
i
),
reverse
=
True
)
S
=
sorted
(
S
,
key
=
lambda
i
:
len
(
i
),
reverse
=
True
)
j
=
0
j
=
0
gongshi_list
=
[]
for
fun
in
indexItem
.
Funs
:
for
fun
in
indexItem
.
Funs
:
print
(
indexItem
.
id
,
"===============gsid"
)
print
(
indexItem
.
id
,
"===============gsid"
)
funstr
=
fun
funstr
=
fun
for
s
in
S
:
for
s
in
S
:
funstr
=
funstr
.
replace
(
s
,
str
(
V
[
s
]))
funstr
=
funstr
.
replace
(
s
,
str
(
V
[
s
]))
strinfo
=
re
.
compile
(
r'X\[\d*\]='
)
strinfo
=
re
.
compile
(
r'X\[\d*\]='
)
funstr
=
strinfo
.
sub
(
""
,
funstr
)
funstr
=
strinfo
.
sub
(
""
,
funstr
)
gongshi_list
.
append
(
funstr
)
try
:
try
:
funstr
=
funstr
.
replace
(
"[("
,
"(("
)
.
replace
(
")]"
,
"))"
)
funstr
=
funstr
.
replace
(
"[("
,
"(("
)
.
replace
(
")]"
,
"))"
)
print
(
funstr
,
"======funstr"
)
val
=
eval
(
funstr
)
val
=
eval
(
funstr
)
X
.
append
(
val
)
X
.
append
(
val
)
j
=
j
+
1
j
=
j
+
1
...
@@ -51,24 +52,26 @@ class IndexComputer:
...
@@ -51,24 +52,26 @@ class IndexComputer:
except
(
ValueError
):
except
(
ValueError
):
print
(
'other:'
,
ValueError
)
print
(
'other:'
,
ValueError
)
return
{
"status_key"
:
0
,
"status_value"
:
"normal"
}
return
{
"status_key"
:
0
,
"status_value"
:
"normal"
}
except
:
return
{
"status_key"
:
0
,
"status_value"
:
"normal"
}
print
(
j
-
1
,
"=====j - 1"
)
if
X
[
j
-
1
]
==
False
:
if
X
[
j
-
1
]
==
False
:
if
indexItem
.
Name
in
[
"销售额变动率"
,
"销售毛利(益)率"
,
"税收负担率"
,
"税收负担变动率"
]:
if
indexItem
.
Name
in
[
"销售额变动率"
,
"销售毛利(益)率"
,
"税收负担率"
,
"税收负担变动率"
]:
last_gongshi
=
gongshi_list
[
-
1
]
last_gongshi
=
gongshi_list
[
-
1
]
print
(
last_gongshi
,
"=========last_gongshi"
)
print
(
last_gongshi
,
"=========last_gongshi"
)
# 2.以and进行分割
# 2.以and进行分割
last_gongshi
=
last_gongshi
.
split
(
"and"
)
last_gongshi
=
last_gongshi
.
split
(
"and"
)
print
(
last_gongshi
[
0
],
last_gongshi
[
1
],
"=====aaa"
)
print
(
last_gongshi
[
0
],
last_gongshi
[
1
],
"=====aaa"
)
print
(
eval
(
last_gongshi
[
0
]),
"=====eval1"
)
print
(
eval
(
last_gongshi
[
0
]),
"=====eval1"
)
print
(
eval
(
last_gongshi
[
1
]),
"=====eval2"
)
print
(
eval
(
last_gongshi
[
1
]),
"=====eval2"
)
if
eval
(
last_gongshi
[
0
])
==
True
and
eval
(
last_gongshi
[
1
])
==
False
:
if
eval
(
last_gongshi
[
0
])
==
True
and
eval
(
last_gongshi
[
1
])
==
False
:
return
{
"status_key"
:
2
,
"status_value"
:
"big"
}
return
{
"status_key"
:
2
,
"status_value"
:
"big"
}
else
:
else
:
return
{
"status_key"
:
2
,
"status_value"
:
"small"
}
return
{
"status_key"
:
2
,
"status_value"
:
"small"
}
else
:
else
:
return
{
"status_key"
:
2
,
"status_value"
:
"normal"
}
return
{
"status_key"
:
2
,
"status_value"
:
"normal"
}
else
:
else
:
return
{
"status_key"
:
1
,
"status_value"
:
"normal"
}
return
{
"status_key"
:
1
,
"status_value"
:
"normal"
}
def
finance_Compute
(
self
,
indexItem
):
def
finance_Compute
(
self
,
indexItem
):
...
...
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