|  | @@ -237,58 +237,64 @@ class JianYeReport(object):
 | 
												
													
														
															|  |          try:
 |  |          try:
 | 
												
													
														
															|  |              save_path = FileUtil().save_path_create()
 |  |              save_path = FileUtil().save_path_create()
 | 
												
													
														
															|  |              send_data = []
 |  |              send_data = []
 | 
												
													
														
															|  | 
 |  | +            error_customer = []
 | 
												
													
														
															|  |              # 查询数据
 |  |              # 查询数据
 | 
												
													
														
															|  |              for customer in customers:
 |  |              for customer in customers:
 | 
												
													
														
															|  | -                # a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id, GROUP_CONCAT(c.house_or_brand_id) as ids
 |  | 
 | 
												
													
														
															|  | -                name = customer[2]
 |  | 
 | 
												
													
														
															|  | -                customer_type = customer[1]
 |  | 
 | 
												
													
														
															|  | -                mail = customer[3]
 |  | 
 | 
												
													
														
															|  | -                ids = customer[6]
 |  | 
 | 
												
													
														
															|  | -                region_name = customer[4]
 |  | 
 | 
												
													
														
															|  | -                title = self.get_mail_title(customer_type, region_name, name)
 |  | 
 | 
												
													
														
															|  | -                content = self.get_mail_content(customer_type)
 |  | 
 | 
												
													
														
															|  | -                file_path = save_path + '/' + title + '.xlsx'
 |  | 
 | 
												
													
														
															|  | -                if customer_type == 2:
 |  | 
 | 
												
													
														
															|  | -                    # 集团
 |  | 
 | 
												
													
														
															|  | -                    table_1 = self.brand_data()
 |  | 
 | 
												
													
														
															|  | -                    house_ids = self.get_house_id_by_brand_id(ids)
 |  | 
 | 
												
													
														
															|  | -                    table_2 = self.house_data(house_ids)
 |  | 
 | 
												
													
														
															|  | -                    # 总浏览量:xx ,总浏览人数:xx
 |  | 
 | 
												
													
														
															|  | -                    #
 |  | 
 | 
												
													
														
															|  | -                    # 新增获客: xx, 新增获电:xx
 |  | 
 | 
												
													
														
															|  | -                    #
 |  | 
 | 
												
													
														
															|  | -                    # 推荐用户数:xx,分享获电:xx,裂变获电:xx
 |  | 
 | 
												
													
														
															|  | -                    #
 |  | 
 | 
												
													
														
															|  | -                    # 全民经纪人注册数:xx
 |  | 
 | 
												
													
														
															|  | -                    #
 |  | 
 | 
												
													
														
															|  | -                    # 报备成功数:xx,报备到访数:xx
 |  | 
 | 
												
													
														
															|  | -                    content = content.format(table_1[0], table_1[1], table_1[2], table_1[3], table_1[4], table_1[5],
 |  | 
 | 
												
													
														
															|  | -                                             table_1[6], table_1[8], table_1[10], table_1[11],
 |  | 
 | 
												
													
														
															|  | -                                             table_1[12], table_1[13], table_1[14], table_1[15], table_1[16], table_1[17],
 |  | 
 | 
												
													
														
															|  | -                                             table_1[18], table_1[20], table_1[22], table_1[23],
 |  | 
 | 
												
													
														
															|  | -                                             table_1[24], table_1[25], table_1[26], table_1[27], table_1[28], table_1[29],
 |  | 
 | 
												
													
														
															|  | -                                             table_1[30], table_1[32], table_1[34], table_1[35]
 |  | 
 | 
												
													
														
															|  | -                                             )
 |  | 
 | 
												
													
														
															|  | -                    send_data.append(
 |  | 
 | 
												
													
														
															|  | -                        [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 |  | 
 | 
												
													
														
															|  | -                         content, name, mail])
 |  | 
 | 
												
													
														
															|  | -                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 |  | 
 | 
												
													
														
															|  | -                elif customer_type == 1:
 |  | 
 | 
												
													
														
															|  | -                    # 项目
 |  | 
 | 
												
													
														
															|  | -                    table_2 = self.house_data(self.get_house_ids(ids))
 |  | 
 | 
												
													
														
															|  | -                    send_data.append(
 |  | 
 | 
												
													
														
															|  | -                        [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 |  | 
 | 
												
													
														
															|  | -                         content, name, mail])
 |  | 
 | 
												
													
														
															|  | -                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 |  | 
 | 
												
													
														
															|  | -                elif customer_type == 3:
 |  | 
 | 
												
													
														
															|  | -                    # 区域
 |  | 
 | 
												
													
														
															|  | -                    table_2 = self.house_data(self.get_house_ids(ids))
 |  | 
 | 
												
													
														
															|  | -                    send_data.append(
 |  | 
 | 
												
													
														
															|  | -                        [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 |  | 
 | 
												
													
														
															|  | -                         content, name, mail])
 |  | 
 | 
												
													
														
															|  | -                    # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 |  | 
 | 
												
													
														
															|  | -                else:
 |  | 
 | 
												
													
														
															|  | -                    pass
 |  | 
 | 
												
													
														
															|  | 
 |  | +                try:
 | 
												
													
														
															|  | 
 |  | +                    # a.task_key, b.customer_type, b.name, b.mail, b.house_or_region, a.customer_id, GROUP_CONCAT(c.house_or_brand_id) as ids
 | 
												
													
														
															|  | 
 |  | +                    name = customer[2]
 | 
												
													
														
															|  | 
 |  | +                    customer_type = customer[1]
 | 
												
													
														
															|  | 
 |  | +                    mail = customer[3]
 | 
												
													
														
															|  | 
 |  | +                    ids = customer[6]
 | 
												
													
														
															|  | 
 |  | +                    region_name = customer[4]
 | 
												
													
														
															|  | 
 |  | +                    title = self.get_mail_title(customer_type, region_name, name)
 | 
												
													
														
															|  | 
 |  | +                    content = self.get_mail_content(customer_type)
 | 
												
													
														
															|  | 
 |  | +                    file_path = save_path + '/' + title + '.xlsx'
 | 
												
													
														
															|  | 
 |  | +                    if customer_type == 2:
 | 
												
													
														
															|  | 
 |  | +                        # 集团
 | 
												
													
														
															|  | 
 |  | +                        table_1 = self.brand_data()
 | 
												
													
														
															|  | 
 |  | +                        house_ids = self.get_house_id_by_brand_id(ids)
 | 
												
													
														
															|  | 
 |  | +                        table_2 = self.house_data(house_ids)
 | 
												
													
														
															|  | 
 |  | +                        # 总浏览量:xx ,总浏览人数:xx
 | 
												
													
														
															|  | 
 |  | +                        #
 | 
												
													
														
															|  | 
 |  | +                        # 新增获客: xx, 新增获电:xx
 | 
												
													
														
															|  | 
 |  | +                        #
 | 
												
													
														
															|  | 
 |  | +                        # 推荐用户数:xx,分享获电:xx,裂变获电:xx
 | 
												
													
														
															|  | 
 |  | +                        #
 | 
												
													
														
															|  | 
 |  | +                        # 全民经纪人注册数:xx
 | 
												
													
														
															|  | 
 |  | +                        #
 | 
												
													
														
															|  | 
 |  | +                        # 报备成功数:xx,报备到访数:xx
 | 
												
													
														
															|  | 
 |  | +                        content = content.format(table_1[0], table_1[1], table_1[2], table_1[3], table_1[4], table_1[5],
 | 
												
													
														
															|  | 
 |  | +                                                 table_1[6], table_1[8], table_1[10], table_1[11],
 | 
												
													
														
															|  | 
 |  | +                                                 table_1[12], table_1[13], table_1[14], table_1[15], table_1[16], table_1[17],
 | 
												
													
														
															|  | 
 |  | +                                                 table_1[18], table_1[20], table_1[22], table_1[23],
 | 
												
													
														
															|  | 
 |  | +                                                 table_1[24], table_1[25], table_1[26], table_1[27], table_1[28], table_1[29],
 | 
												
													
														
															|  | 
 |  | +                                                 table_1[30], table_1[32], table_1[34], table_1[35]
 | 
												
													
														
															|  | 
 |  | +                                                 )
 | 
												
													
														
															|  | 
 |  | +                        send_data.append(
 | 
												
													
														
															|  | 
 |  | +                            [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 | 
												
													
														
															|  | 
 |  | +                             content, name, mail])
 | 
												
													
														
															|  | 
 |  | +                        # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
												
													
														
															|  | 
 |  | +                    elif customer_type == 1:
 | 
												
													
														
															|  | 
 |  | +                        # 项目
 | 
												
													
														
															|  | 
 |  | +                        table_2 = self.house_data(self.get_house_ids(ids))
 | 
												
													
														
															|  | 
 |  | +                        send_data.append(
 | 
												
													
														
															|  | 
 |  | +                            [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 | 
												
													
														
															|  | 
 |  | +                             content, name, mail])
 | 
												
													
														
															|  | 
 |  | +                        # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
												
													
														
															|  | 
 |  | +                    elif customer_type == 3:
 | 
												
													
														
															|  | 
 |  | +                        # 区域
 | 
												
													
														
															|  | 
 |  | +                        table_2 = self.house_data(self.get_house_ids(ids))
 | 
												
													
														
															|  | 
 |  | +                        send_data.append(
 | 
												
													
														
															|  | 
 |  | +                            [table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path,
 | 
												
													
														
															|  | 
 |  | +                             content, name, mail])
 | 
												
													
														
															|  | 
 |  | +                        # rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
 | 
												
													
														
															|  | 
 |  | +                    else:
 | 
												
													
														
															|  | 
 |  | +                        pass
 | 
												
													
														
															|  | 
 |  | +                except Exception as e:
 | 
												
													
														
															|  | 
 |  | +                    print(str(e))
 | 
												
													
														
															|  | 
 |  | +                    error_customer.append(str(e))
 | 
												
													
														
															|  | 
 |  | +            message['errors'] = e
 | 
												
													
														
															|  |              message['query_data'] = 'success'
 |  |              message['query_data'] = 'success'
 | 
												
													
														
															|  |              # 生成文件
 |  |              # 生成文件
 | 
												
													
														
															|  |              for data in send_data:
 |  |              for data in send_data:
 |