|
@@ -237,58 +237,64 @@ class JianYeReport(object):
|
|
|
try:
|
|
|
save_path = FileUtil().save_path_create()
|
|
|
send_data = []
|
|
|
+ error_customer = []
|
|
|
|
|
|
for customer in customers:
|
|
|
-
|
|
|
- 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)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- 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])
|
|
|
-
|
|
|
- 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])
|
|
|
-
|
|
|
- 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])
|
|
|
-
|
|
|
- else:
|
|
|
- pass
|
|
|
+ try:
|
|
|
+
|
|
|
+ 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)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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])
|
|
|
+
|
|
|
+ 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])
|
|
|
+
|
|
|
+ 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])
|
|
|
+
|
|
|
+ else:
|
|
|
+ pass
|
|
|
+ except Exception as e:
|
|
|
+ print(str(e))
|
|
|
+ error_customer.append(str(e))
|
|
|
+ message['errors'] = e
|
|
|
message['query_data'] = 'success'
|
|
|
|
|
|
for data in send_data:
|