导出前执行的code receive_data 的格式是以下格式
{'data': [(u'MD19467', u'\u9014\u864e\u517b\u8f66\u5de5\u573a\u5e97\uff08\u65e0\u9521\u4e0a\u9a6c\u58a9\u8def\u5e97\uff09', u'31.5876910000', u'120.3263570000', u'gps_attendance', u'\u6c5f\u82cf\u7701\u65e0\u9521\u5e02\u5d07\u5b89\u533a\u4e0a\u9a6c\u58a9\u8def\uff082\u53f7\u7ebf1\u53f7\u51fa\u53e3\u5904\uff09')], 'col_index': {u'attendance_type':
{'lang': False, 'excel_col': '\xe8\x80\x83\xe5\x8b\xa4\xe6\x96\xb9\xe5\xbc\x8f', 'col_index': 4}
, u'att_point_code':
{'lang': False, 'excel_col': '\xe8\x80\x83\xe5\x8b\xa4\xe7\x82\xb9\xe7\xbc\x96\xe7\xa0\x81', 'col_index': 0}
, u'name':
{'lang': False, 'excel_col': '\xe5\x90\x8d\xe7\xa7\xb0', 'col_index': 1}
, u'latitude':
{'lang': False, 'excel_col': '\xe7\xba\xac\xe5\xba\xa6', 'col_index': 2}
, u'street':
{'lang': False, 'excel_col': '\xe8\xa1\x97\xe9\x81\x93', 'col_index': 5}
, u'longitude':
{'lang': False, 'excel_col': '\xe7\xbb\x8f\xe5\xba\xa6', 'col_index': 3}
}}
处理代码:
_logger.info('----1-----------')
_logger.info(receive_data)
_logger.info('----1-----------')
handled_data = {}
if receive_data:
if receive_data.get('col_index',False):
col_index = receive_data.get('col_index')
col_index['is_company'] =
{'lang': False, 'excel_col': '是公司', 'col_index': 6}
col_index['lang'] =
{'lang': False, 'excel_col': '语言', 'col_index': 7}
col_index['worktime_start'] =
{'lang': False, 'excel_col': '上班时间', 'col_index': 8}
col_index['worktime_end'] =
{'lang': False, 'excel_col': '下班时间', 'col_index': 9}
col_index['morning_start'] =
{'lang': False, 'excel_col': '上午开始时间', 'col_index': 10}
col_index['morning_end'] =
{'lang': False, 'excel_col': '上午结束时间', 'col_index': 11}
col_index['afternoon_start'] =
{'lang': False, 'excel_col': '下午开始时间', 'col_index': 12}
col_index['afternoon_end'] =
{'lang': False, 'excel_col': '下午结束时间', 'col_index': 13}
handled_data['import_fields'] = col_index
_logger.info('------2---------')
_logger.info(handled_data)
_logger.info('------2---------')
if receive_data.get('data',False):
data_modified = receive_data.get('data',False)
data_modified1=[]
for v in data_modified:
v=v+(True,'zh_CN',9,18,9,12,13,18)
data_modified1.append(v)
handled_data['import_data'] = data_modified1
_logger.info('------3---------')
_logger.info(handled_data)
_logger.info('------3---------')
local_dict.update(
{'handled_data': handled_data}
)