Commit cc802e9e by 黄静

hj

parent 80ff4169
...@@ -17,14 +17,15 @@ class IndexComputer: ...@@ -17,14 +17,15 @@ class IndexComputer:
S = [] S = []
for factorkey in indexItem.FactorsValue: for factorkey in indexItem.FactorsValue:
tempval = indexItem.FactorsValue[factorkey] tempval = indexItem.FactorsValue[factorkey]
tempval = str(tempval)
if indexItem.FactorsValue[factorkey] is None: if indexItem.FactorsValue[factorkey] is None:
print("is None") print("is None")
return "0" return {"status_key":0,"status_value":"normal"}
try: try:
eval(tempval) eval(tempval)
except: except:
print("is isNumeric", indexItem.FactorsValue[factorkey]) print("is isNumeric", indexItem.FactorsValue[factorkey])
return "0" return {"status_key":0,"status_value":"normal"}
Y.append(float(indexItem.FactorsValue[factorkey])) Y.append(float(indexItem.FactorsValue[factorkey]))
V[factorkey] = str("Y[" + str(i) + "]") V[factorkey] = str("Y[" + str(i) + "]")
S.append(factorkey) S.append(factorkey)
...@@ -39,20 +40,36 @@ class IndexComputer: ...@@ -39,20 +40,36 @@ class IndexComputer:
strinfo = re.compile(r'X\[\d*\]=') strinfo = re.compile(r'X\[\d*\]=')
funstr = strinfo.sub("", funstr) funstr = strinfo.sub("", funstr)
try: try:
funstr = funstr.replace("[(", "((").replace(")]", "))")
print(funstr,"======funstr") print(funstr,"======funstr")
val = eval(funstr) val = eval(funstr)
X.append(val) X.append(val)
j = j + 1 j = j + 1
except ZeroDivisionError as err: except ZeroDivisionError as err:
print('Handling run-time error:', err) print('Handling run-time error:', err)
return "0" return {"status_key":0,"status_value":"normal"}
except(ValueError): except(ValueError):
print('other:', ValueError) print('other:', ValueError)
return "0" return {"status_key":0,"status_value":"normal"}
if X[j - 1] == True:
return "2" 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: else:
return "1" return {"status_key": 1, "status_value": "normal"}
def finance_Compute(self, indexItem): def finance_Compute(self, indexItem):
finance_result = {} finance_result = {}
......
...@@ -38,7 +38,7 @@ class RiskComputer: ...@@ -38,7 +38,7 @@ class RiskComputer:
ret=ic.Compute(indexItem) ret=ic.Compute(indexItem)
self.IndexRes[indexItem.Name]=ret self.IndexRes[indexItem.Name]=ret
else: else:
self.IndexRes[indexItem.Name]="0" self.IndexRes[indexItem.Name]={"status_key":0,"status_value":"normal"}
else: else:
if flag: if flag:
ret1 = ic.finance_Compute(indexItem) 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