Skip to content

Commit

Permalink
bugfix: PARTICIPANT_TYPE_MULTI_ALL
Browse files Browse the repository at this point in the history
  • Loading branch information
blackholll committed Mar 18, 2019
1 parent d2175e4 commit e333725
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
56 changes: 37 additions & 19 deletions service/ticket/ticket_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,22 +750,22 @@ def get_ticket_format_participant_info(cls, ticket_id):
else:
participant_alias_list.append(participant_user_obj.alias)
participant_alias = ','.join(participant_alias_list)
elif participant_type_id == CONSTANT_SERVICE.PARTICIPANT_TYPE_MULTI_ALL:
participant_type_name = '多人且全部处理'
# 从multi_all_person中获取处理人信息
multi_all_person_dict = json.loads(ticket_obj.multi_all_person)
participant_alias0_list = []
for key, value in multi_all_person_dict.items():
participant_user_obj, msg = AccountBaseService.get_user_by_username(key)
if not participant_user_obj:
participant_alias0 = key
else:
participant_alias0 = participant_user_obj.alias
if value:
participant_alias0_list.append('{}({})已处理:{}'.format(participant_alias0, key, value.get('transition_name')))
else:
participant_alias0_list.append('{}({})未处理:{}'.format(participant_alias0, key, value.get('transition_name')))
participant_alias = ';'.join(participant_alias0_list)
# elif participant_type_id == CONSTANT_SERVICE.PARTICIPANT_TYPE_MULTI_ALL:
# participant_type_name = '多人且全部处理'
# # 从multi_all_person中获取处理人信息
# multi_all_person_dict = json.loads(ticket_obj.multi_all_person)
# participant_alias0_list = []
# for key, value in multi_all_person_dict.items():
# participant_user_obj, msg = AccountBaseService.get_user_by_username(key)
# if not participant_user_obj:
# participant_alias0 = key
# else:
# participant_alias0 = participant_user_obj.alias
# if value:
# participant_alias0_list.append('{}({})已处理:{}'.format(participant_alias0, key, value.get('transition_name')))
# else:
# participant_alias0_list.append('{}({})未处理:{}'.format(participant_alias0, key, value.get('transition_name')))
# participant_alias = ';'.join(participant_alias0_list)

elif participant_type_id == CONSTANT_SERVICE.PARTICIPANT_TYPE_DEPT:
participant_type_name = '部门'
Expand All @@ -781,6 +781,24 @@ def get_ticket_format_participant_info(cls, ticket_id):
return False, 'role is not existedor has been deleted'
participant_name = role_obj.name
participant_alias = participant_name
if ticket_obj.multi_all_person:
participant_type_name = '多人且全部处理'
# 从multi_all_person中获取处理人信息
multi_all_person_dict = json.loads(ticket_obj.multi_all_person)
participant_alias0_list = []
for key, value in multi_all_person_dict.items():
participant_user_obj, msg = AccountBaseService.get_user_by_username(key)
if not participant_user_obj:
participant_alias0 = key
else:
participant_alias0 = participant_user_obj.alias
if value:
participant_alias0_list.append(
'{}({})已处理:{}'.format(participant_alias0, key, value.get('transition_name')))
else:
participant_alias0_list.append(
'{}({})未处理:{}'.format(participant_alias0, key, value.get('transition_name')))
participant_alias = ';'.join(participant_alias0_list)
# 工单基础表中不存在参与人为其他类型的情况
return dict(participant=participant, participant_name=participant_name, participant_type_id=participant_type_id,
participant_type_name=participant_type_name, participant_alias=participant_alias), ''
Expand Down Expand Up @@ -959,7 +977,7 @@ def handle_ticket(cls, ticket_id, request_data_dict, by_timer=False):
destination_state, msg = WorkflowStateService.get_workflow_state_by_id(destination_state_id)

# 判断当前处理人类似是否为全部处理,如果处理类型为全部处理,且有人未处理,则工单状态不变,只记录处理过程
if ticket_obj.participant_type_id == CONSTANT_SERVICE.PARTICIPANT_TYPE_MULTI_ALL:
if ticket_obj.multi_all_person:
multi_all_person = ticket_obj.multi_all_person
multi_all_person_dict = json.loads(multi_all_person)
blank_or_false_value_key_list, msg = CommonService.get_dict_blank_or_false_value_key_list(multi_all_person_dict)
Expand All @@ -976,7 +994,7 @@ def handle_ticket(cls, ticket_id, request_data_dict, by_timer=False):
destination_participant = participant_info.get('destination_participant', '')
else:
# 处理人没有没有全部处理完成或者处理动作不一致
destination_participant_type_id = CONSTANT_SERVICE.PARTICIPANT_TYPE_MULTI_ALL
destination_participant_type_id = ticket_obj.participant_type_id
next_blank_or_false_value_key_list, msg = CommonService.get_dict_blank_or_false_value_key_list(multi_all_person_dict)
destination_participant = ','.join(next_blank_or_false_value_key_list)

Expand Down Expand Up @@ -1592,7 +1610,7 @@ def get_ticket_state_participant_info(cls, state_id, ticket_id=0, ticket_req_dic
destination_participant = random.sample(destination_participant_list, 1)[0]
destination_participant_type_id = CONSTANT_SERVICE.PARTICIPANT_TYPE_PERSONAL
if state_obj.distribute_type_id == CONSTANT_SERVICE.STATE_DISTRIBUTE_TYPE_ALL:
destination_participant_type_id = CONSTANT_SERVICE.STATE_DISTRIBUTE_TYPE_ALL
# destination_participant_type_id = CONSTANT_SERVICE.PARTICIPANT_TYPE_MULTI_ALL # 不新增类型,直接用原来的类型。这样方便待办查询
multi_all_person_dict = {}
for destination_participant_0 in destination_participant_list:
multi_all_person_dict[destination_participant_0] = {}
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def send_ticket_notice(ticket_id):
notice_script_file = os.path.join(settings.MEDIA_ROOT, notice_script_file_name)

globals = {'title_result': title_result, 'content_result': content_result, 'participant': ticket_obj.participant,
'participant_type_id': ticket_obj.participant_type_id}
'participant_type_id': ticket_obj.participant_type_id, 'multi_all_person':ticket_obj.multi_all_person}
try:
with stdoutIO() as s:
# execfile(script_file, globals) # for python 2
Expand Down

0 comments on commit e333725

Please sign in to comment.