Skip to content

Commit

Permalink
Merge branch 'r0.3.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
blackholll committed Sep 1, 2019
2 parents 42a53d8 + c0c4a9b commit 3e2fa90
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ loonflow只提供后端调用api和工作流的配置后台,感谢youshutong20
- 工作流配置管理后台

# 相关术语(如转交、接单、加签等等)
[使用文档](docs/index.md)
[使用文档](https://github.com/blackholll/loonflow/wiki)

# 欢迎捐助
您的支持是我最大的动力,欢迎支付宝扫码捐助
Expand Down
43 changes: 24 additions & 19 deletions service/ticket/ticket_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def get_ticket_detail(cls, ticket_id, username):
if not view_permission:
return False, msg
ticket_obj = TicketRecord.objects.filter(id=ticket_id, is_deleted=0).first()
field_list, msg = cls.get_ticket_base_filed_list(ticket_id)
field_list, msg = cls.get_ticket_base_field_list(ticket_id)

new_field_list = []

Expand Down Expand Up @@ -667,7 +667,7 @@ def get_ticket_detail(cls, ticket_id, username):

@classmethod
@auto_log
def get_ticket_base_filed_list(cls, ticket_id):
def get_ticket_base_field_list(cls, ticket_id):
"""
获取工单字段信息,
:param ticket_id:
Expand Down Expand Up @@ -700,41 +700,46 @@ def get_ticket_base_filed_list(cls, ticket_id):

# 工单所有自定义字段
custom_field_dict, msg = WorkflowCustomFieldService.get_workflow_custom_field(ticket_obj.workflow_id)
custom_field_key_list = [key for key, value in custom_field_dict.items()]
ticket_custom_field_objs = TicketCustomField.objects.filter(ticket_id=ticket_id, field_key__in=custom_field_key_list, is_deleted=0).all()
key_value_dict = {}
for ticket_custom_field_obj in ticket_custom_field_objs:
key_value_dict[ticket_custom_field_obj.field_key] = ticket_custom_field_obj
for key, value in custom_field_dict.items():
field_type_id = value['field_type_id']
ticket_custom_field_obj = TicketCustomField.objects.filter(ticket_id=ticket_id,field_key=key, is_deleted=0).first()
if not ticket_custom_field_obj:
field_value = None # 尚未赋值的情况
field_value_obj = key_value_dict.get(key)
if not field_value_obj:
field_value = None
else:
# 根据字段类型 获取对应列的值
if field_type_id == CONSTANT_SERVICE.FIELD_TYPE_STR:
field_value = ticket_custom_field_obj.char_value
field_value = field_value_obj.char_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_INT:
field_value = ticket_custom_field_obj.int_value
field_value = field_value_obj.int_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_FLOAT:
field_value = ticket_custom_field_obj.float_value
field_value = field_value_obj.float_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_BOOL:
field_value = ticket_custom_field_obj.bool_value
field_value = field_value_obj.bool_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_DATE:
field_value = str(ticket_custom_field_obj.date_value)
field_value = str(field_value_obj.date_value)
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_DATETIME:
field_value = str(ticket_custom_field_obj.datetime_value)
field_value = str(field_value_obj.datetime_value)
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_RADIO:
field_value = ticket_custom_field_obj.radio_value
field_value = field_value_obj.radio_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_CHECKBOX:
field_value = ticket_custom_field_obj.checkbox_value
field_value = field_value_obj.checkbox_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_SELECT:
field_value = ticket_custom_field_obj.select_value
field_value = field_value_obj.select_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_MULTI_SELECT:
field_value = ticket_custom_field_obj.multi_select_value
field_value = field_value_obj.multi_select_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_TEXT:
field_value = ticket_custom_field_obj.text_value
field_value = field_value_obj.text_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_USERNAME:
field_value = ticket_custom_field_obj.username_value
field_value = field_value_obj.username_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_MULTI_USERNAME:
field_value = ticket_custom_field_obj.multi_username_value
field_value = field_value_obj.multi_username_value
elif field_type_id == CONSTANT_SERVICE.FIELD_TYPE_ATTACHMENT:
field_value = ticket_custom_field_obj.char_value
field_value = field_value_obj.char_value

field_list.append(dict(field_key=key, field_name=custom_field_dict[key]['field_name'], field_value=field_value, order_id=custom_field_dict[key]['order_id'],
field_type_id=custom_field_dict[key]['field_type_id'],
Expand Down

0 comments on commit 3e2fa90

Please sign in to comment.