优化金额处理
This commit is contained in:
@@ -9,8 +9,14 @@ from util import common_util
|
|||||||
def handle_decimal(string):
|
def handle_decimal(string):
|
||||||
if not string:
|
if not string:
|
||||||
return ''
|
return ''
|
||||||
|
original_string = string
|
||||||
string = re.sub(r'[^0-9.]', '', string)
|
string = re.sub(r'[^0-9.]', '', string)
|
||||||
if not string:
|
if not string:
|
||||||
|
# 可能抓到大写金额了,尝试用大写金额解析
|
||||||
|
try:
|
||||||
|
return common_util.chinese_money_to_number(original_string)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning('大写金额解析失败', exc_info=e)
|
||||||
return ''
|
return ''
|
||||||
if '.' not in string:
|
if '.' not in string:
|
||||||
if len(string) > 2:
|
if len(string) > 2:
|
||||||
|
|||||||
Reference in New Issue
Block a user