Skip to content

Commit

Permalink
bugfix: char value in condition_expression can not be format correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
blackholll committed Jun 1, 2019
1 parent 8833ca3 commit 6ab2246
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions service/ticket/ticket_base_service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import json
import datetime
import random
Expand Down Expand Up @@ -1737,11 +1738,15 @@ def get_next_state_id_by_transition_and_ticket_info(cls, ticket_id=0, ticket_req
# 获取工单所有字段的值
ticket_all_value_dict, msg = cls.get_ticket_all_field_value(ticket_id)
# 更新当前更新的字段的值
ticket_all_value_dict.update(ticket_req_dict)
ticket_all_value_dict_copy = copy.deepcopy(ticket_all_value_dict)
ticket_all_value_dict_copy.update(ticket_req_dict)
for key, value in ticket_all_value_dict_copy.items():
if isinstance(ticket_all_value_dict_copy[key], str):
ticket_all_value_dict_copy[key] = "'''" + ticket_all_value_dict_copy[key] + "'''"

for condition_expression0 in condition_expression_list:
expression = condition_expression0.get('expression')
expression_format = expression.format(**ticket_all_value_dict)
expression_format = expression.format(**ticket_all_value_dict_copy)
import datetime, time # 用于支持条件表达式中对时间的操作
if eval(expression_format):
destination_state_id = condition_expression0.get('target_state_id')
Expand Down

0 comments on commit 6ab2246

Please sign in to comment.