Commit cc802e9e by 黄静

hj

parent 80ff4169
......@@ -17,14 +17,15 @@ class IndexComputer:
S = []
for factorkey in indexItem.FactorsValue:
tempval = indexItem.FactorsValue[factorkey]
tempval = str(tempval)
if indexItem.FactorsValue[factorkey] is None:
print("is None")
return "0"
return {"status_key":0,"status_value":"normal"}
try:
eval(tempval)
except:
print("is isNumeric", indexItem.FactorsValue[factorkey])
return "0"
return {"status_key":0,"status_value":"normal"}
Y.append(float(indexItem.FactorsValue[factorkey]))
V[factorkey] = str("Y[" + str(i) + "]")
S.append(factorkey)
......@@ -39,20 +40,36 @@ class IndexComputer:
strinfo = re.compile(r'X\[\d*\]=')
funstr = strinfo.sub("", funstr)
try:
funstr = funstr.replace("[(", "((").replace(")]", "))")
print(funstr,"======funstr")
val = eval(funstr)
X.append(val)
j = j + 1
except ZeroDivisionError as err:
print('Handling run-time error:', err)
return "0"
return {"status_key":0,"status_value":"normal"}
except(ValueError):
print('other:', ValueError)
return "0"
if X[j - 1] == True:
return "2"
return {"status_key":0,"status_value":"normal"}
if X[j - 1] == False:
if indexItem.Name in ["销售额变动率", "销售毛利(益)率", "税收负担率", "税收负担变动率"]:
last_gongshi = gongshi_list[-1]
print(last_gongshi, "=========last_gongshi")
# 2.以and进行分割
last_gongshi = last_gongshi.split("and")
print(last_gongshi[0], last_gongshi[1], "=====aaa")
print(eval(last_gongshi[0]), "=====eval1")
print(eval(last_gongshi[1]), "=====eval2")
if eval(last_gongshi[0]) == True and eval(last_gongshi[1]) == False:
return {"status_key": 2, "status_value": "big"}
else:
return {"status_key": 2, "status_value": "small"}
else:
return {"status_key": 2, "status_value": "normal"}
else:
return "1"
return {"status_key": 1, "status_value": "normal"}
def finance_Compute(self, indexItem):
finance_result = {}
......
......@@ -38,7 +38,7 @@ class RiskComputer:
ret=ic.Compute(indexItem)
self.IndexRes[indexItem.Name]=ret
else:
self.IndexRes[indexItem.Name]="0"
self.IndexRes[indexItem.Name]={"status_key":0,"status_value":"normal"}
else:
if flag:
ret1 = ic.finance_Compute(indexItem)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment