Browse Source

修改数据处理逻辑

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 5 years ago
parent
commit
5fbe4c926a
2 changed files with 10 additions and 10 deletions
  1. 1 1
      flask_app.py
  2. 9 9
      report_push.py

+ 1 - 1
flask_app.py

@@ -227,7 +227,7 @@ def report_test():
     try:
     try:
         task_id = request.args.get('id', default=0, type=int)
         task_id = request.args.get('id', default=0, type=int)
         report_push = ReportPush('bi_report')
         report_push = ReportPush('bi_report')
-        result = report_push.report_push(task_id)
+        result = report_push.report_data_query(task_id)
     except Exception as e:
     except Exception as e:
         print(str(e))
         print(str(e))
         result['error'] = str(e)
         result['error'] = str(e)

+ 9 - 9
report_push.py

@@ -434,7 +434,7 @@ class ReportPush(object):
 
 
     # 根据集团id获取项目id
     # 根据集团id获取项目id
     sql_5 = """
     sql_5 = """
-        select house_id, house_name from d_house where brand_id = %s
+        select house_id, house_name from d_house where brand_id = %s and house_id > 300
     """
     """
 
 
     sql_5_1 = """
     sql_5_1 = """
@@ -571,19 +571,19 @@ class ReportPush(object):
                 # 排名	项目名称	总浏览量	总浏览人数	新增获客	新增获电
                 # 排名	项目名称	总浏览量	总浏览人数	新增获客	新增获电
                 for index, x in enumerate(xcx_top_data_part):
                 for index, x in enumerate(xcx_top_data_part):
                     if x[0] in house_ids:
                     if x[0] in house_ids:
-                        result_data_4.append([index, x[1], x[2], x[3], x[4], x[5]])
+                        result_data_4.append([index + 1, x[1], x[2], x[3], x[4], x[5]])
                 # 5: 集团项目数据排行榜
                 # 5: 集团项目数据排行榜
                 # 排名	项目名称	总浏览量	总浏览人数	新增获客	新增获电
                 # 排名	项目名称	总浏览量	总浏览人数	新增获客	新增获电
                 if customer_type == 2:
                 if customer_type == 2:
                     for index, x2 in enumerate(brand_top_data_part):
                     for index, x2 in enumerate(brand_top_data_part):
                         if x2[1] in house_ids or x2[0] in brand_id_list:
                         if x2[1] in house_ids or x2[0] in brand_id_list:
-                            result_data_5.append([index, x2[2], x2[3], x2[4], x2[5], x2[6]])
+                            result_data_5.append([index + 1, x2[2], x2[3], x2[4], x2[5], x2[6]])
                         pass
                         pass
                     pass
                     pass
                 elif customer_type == 1:
                 elif customer_type == 1:
                     for index, x1 in enumerate(brand_top_data_part):
                     for index, x1 in enumerate(brand_top_data_part):
                         if x1[1] in house_ids:
                         if x1[1] in house_ids:
-                            result_data_5.append([index, x1[2], x1[3], x1[4], x1[5], x1[6]])
+                            result_data_5.append([index + 1, x1[2], x1[3], x1[4], x1[5], x1[6]])
                 else:
                 else:
                     pass
                     pass
                 # 2: 项目数据排行榜
                 # 2: 项目数据排行榜
@@ -599,14 +599,14 @@ class ReportPush(object):
                 # 排名 项目名称	总浏览量	总浏览人数 新增获客 新增获电
                 # 排名 项目名称	总浏览量	总浏览人数 新增获客 新增获电
                 if customer_type == 2:
                 if customer_type == 2:
                     all_data_history = self.house_with_brand(xcx_top_data_all_part, brand_top_data_all_part, brand_id_list)
                     all_data_history = self.house_with_brand(xcx_top_data_all_part, brand_top_data_all_part, brand_id_list)
-                    for index, x in enumerate(all_data_history):
-                        if x[2] in house_ids or x[1] in brand_id_list:
+                    for x in all_data_history:
+                        if x[2] in house_ids:
                             x.pop(1)
                             x.pop(1)
                             x.pop(1)
                             x.pop(1)
                             result_data_3.append(x)
                             result_data_3.append(x)
                 else:
                 else:
                     all_data_history = self.house_with_brand(xcx_top_data_all_part, brand_top_data_all_part)
                     all_data_history = self.house_with_brand(xcx_top_data_all_part, brand_top_data_all_part)
-                    for index, x in enumerate(all_data_history):
+                    for x in all_data_history:
                         if x[2] in house_ids:
                         if x[2] in house_ids:
                             x.pop(1)
                             x.pop(1)
                             x.pop(1)
                             x.pop(1)
@@ -843,8 +843,8 @@ class ReportPush(object):
                 pass
                 pass
         if brands:
         if brands:
             for index, x in enumerate(brand_top_data):
             for index, x in enumerate(brand_top_data):
-                if x[0] in brands and x[1] is not None and int(x[1]) < 300:
-                    _x = [index]
+                if x[0] in brands and x[1] is not None and int(x[1]) == 0:
+                    _x = [index + 1]
                     _x.extend(x)
                     _x.extend(x)
                     result.append(_x)
                     result.append(_x)
         result.sort(key=lambda obj: obj[3])
         result.sort(key=lambda obj: obj[3])