|
@@ -111,7 +111,8 @@ class TongCe:
|
|
SELECT
|
|
SELECT
|
|
id,
|
|
id,
|
|
sub_question_id,
|
|
sub_question_id,
|
|
- sub_option_id
|
|
|
|
|
|
+ sub_option_id,
|
|
|
|
+ data_item_title
|
|
FROM
|
|
FROM
|
|
mvp_page_display_match
|
|
mvp_page_display_match
|
|
WHERE
|
|
WHERE
|
|
@@ -202,6 +203,8 @@ class TongCe:
|
|
,m.father_id
|
|
,m.father_id
|
|
,m.sub_question_id
|
|
,m.sub_question_id
|
|
,m.sub_question_content
|
|
,m.sub_question_content
|
|
|
|
+ ,m.option_tags as option_id
|
|
|
|
+ ,m.father_content as option_content
|
|
,m.sub_option_id
|
|
,m.sub_option_id
|
|
,m.sub_option_content
|
|
,m.sub_option_content
|
|
,m.testcase_id
|
|
,m.testcase_id
|
|
@@ -308,7 +311,8 @@ class TongCe:
|
|
b.sub_question_id,
|
|
b.sub_question_id,
|
|
b.sub_question_content,
|
|
b.sub_question_content,
|
|
b.sub_option_id,
|
|
b.sub_option_id,
|
|
- b.sub_option_content
|
|
|
|
|
|
+ b.sub_option_content,
|
|
|
|
+ b.option_tags
|
|
FROM
|
|
FROM
|
|
f_t_daren_score_2 a
|
|
f_t_daren_score_2 a
|
|
LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
|
|
LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
|
|
@@ -388,6 +392,7 @@ class TongCe:
|
|
self.marketing_db = MysqlDB('bi_report')
|
|
self.marketing_db = MysqlDB('bi_report')
|
|
self.linshi_db = MysqlDB('linshi', db_type=1)
|
|
self.linshi_db = MysqlDB('linshi', db_type=1)
|
|
self.options_info = ExcelUtil('工作表6', 'tongce.xlsx').read_options_info()
|
|
self.options_info = ExcelUtil('工作表6', 'tongce.xlsx').read_options_info()
|
|
|
|
+ self.table_type_info = ExcelUtil('新增项目数据项类型排序与展示图表类型管理表', 'table_type.xlsx').get_table_type_info()
|
|
|
|
|
|
def get_question_info_from_db(self):
|
|
def get_question_info_from_db(self):
|
|
result = self.shangju_db.select(self.sql_2, [67])
|
|
result = self.shangju_db.select(self.sql_2, [67])
|
|
@@ -426,7 +431,7 @@ class TongCe:
|
|
self.linshi_db.add_some(self.sql_13, insert_data)
|
|
self.linshi_db.add_some(self.sql_13, insert_data)
|
|
|
|
|
|
sql_15 = '''
|
|
sql_15 = '''
|
|
- select id, pay_ability, age_area, city_name, life_cycle from mvp_crowd_info where status = 1
|
|
|
|
|
|
+ select id, pay_ability, age_area, city_name, life_cycle from mvp_crowd_info where status = 1 and house_id = 67
|
|
'''
|
|
'''
|
|
|
|
|
|
def get_crowd_info(self):
|
|
def get_crowd_info(self):
|
|
@@ -465,21 +470,22 @@ class TongCe:
|
|
|
|
|
|
def lingdi_data_scores(self):
|
|
def lingdi_data_scores(self):
|
|
# 1: 写入mvp_crowd_info
|
|
# 1: 写入mvp_crowd_info
|
|
- self.insert_into_mvp_crowd_info()
|
|
|
|
|
|
+ # self.insert_into_mvp_crowd_info()
|
|
crowd_info = self.get_crowd_info()
|
|
crowd_info = self.get_crowd_info()
|
|
# 2: 写入rule
|
|
# 2: 写入rule
|
|
- self.insert_into_rule()
|
|
|
|
|
|
+ # self.insert_into_rule()
|
|
rule = self.get_rule_data_info()
|
|
rule = self.get_rule_data_info()
|
|
# 3: 读入答题数据
|
|
# 3: 读入答题数据
|
|
self.answers = self.marketing_db.select(self.sql_9)
|
|
self.answers = self.marketing_db.select(self.sql_9)
|
|
# 4: 写入match信息
|
|
# 4: 写入match信息
|
|
match_data = self.get_question_info_from_db()
|
|
match_data = self.get_question_info_from_db()
|
|
- self.linshi_db.truncate('mvp_page_display_match')
|
|
|
|
- self.linshi_db.add_some(self.sql_3, match_data)
|
|
|
|
|
|
+ # self.linshi_db.truncate('mvp_page_display_match')
|
|
|
|
+ # self.linshi_db.add_some(self.sql_3, match_data)
|
|
self.match_data_info = self.get_option_match_info()
|
|
self.match_data_info = self.get_option_match_info()
|
|
|
|
|
|
# 筛选写入data的数据
|
|
# 筛选写入data的数据
|
|
insert_data = []
|
|
insert_data = []
|
|
|
|
+ no_data_case = []
|
|
for ci in crowd_info:
|
|
for ci in crowd_info:
|
|
crowd_info_id = ci[0]
|
|
crowd_info_id = ci[0]
|
|
zhifuli = ci[1]
|
|
zhifuli = ci[1]
|
|
@@ -502,16 +508,42 @@ class TongCe:
|
|
for od in option_data_1:
|
|
for od in option_data_1:
|
|
option_data_list.append([x for x in od])
|
|
option_data_list.append([x for x in od])
|
|
if len(option_data_list) >= 0:
|
|
if len(option_data_list) >= 0:
|
|
- match_id = 0
|
|
|
|
option_id = option_data_list[0][2]
|
|
option_id = option_data_list[0][2]
|
|
for md in self.match_data_info:
|
|
for md in self.match_data_info:
|
|
if str(md[1]) == str(key) and str(md[2]) == str(option_id):
|
|
if str(md[1]) == str(key) and str(md[2]) == str(option_id):
|
|
match_id = md[0]
|
|
match_id = md[0]
|
|
- insert_data.append([crowd_info_id, match_id, rule_id, option_name, len(option_data_list) / question_people])
|
|
|
|
|
|
+ option_name_alias = md[3]
|
|
|
|
+ insert_data.append([crowd_info_id, match_id, rule_id, option_name_alias, len(option_data_list) / question_people])
|
|
|
|
+ else:
|
|
|
|
+ no_data_case.append([zhifuli, city, age, juzhujiegou, option_name])
|
|
|
|
+ else:
|
|
|
|
+ no_data_case.append([zhifuli, city, age, juzhujiegou, key])
|
|
|
|
+ quanliang_scores = self.scores()
|
|
|
|
+ for q_s in quanliang_scores:
|
|
|
|
+ rule_id = self.get_rule_id(q_s[0], rule)
|
|
|
|
+ if rule_id:
|
|
|
|
+ for md in self.match_data_info:
|
|
|
|
+ if str(md[1]) == str(q_s[0]) and str(md[1]) == str(q_s[1]):
|
|
|
|
+ match_id = md[0]
|
|
|
|
+ option_name_alias = md[3]
|
|
|
|
+ insert_data.append([5405, match_id, rule_id, option_name_alias, q_s[2]])
|
|
|
|
+
|
|
if len(insert_data) > 0:
|
|
if len(insert_data) > 0:
|
|
self.linshi_db.truncate('mvp_page_display_data')
|
|
self.linshi_db.truncate('mvp_page_display_data')
|
|
self.linshi_db.add_some(self.sql_6, insert_data)
|
|
self.linshi_db.add_some(self.sql_6, insert_data)
|
|
- return len(insert_data)
|
|
|
|
|
|
+
|
|
|
|
+ return {'写入库中的数据': len(insert_data), '无数据': len(no_data_case)}
|
|
|
|
+
|
|
|
|
+ sql_20 = '''
|
|
|
|
+ UPDATE mvp_page_display_rule
|
|
|
|
+ SET display_type = %s,
|
|
|
|
+ display_size = %s
|
|
|
|
+ WHERE
|
|
|
|
+ title_in_page = %s
|
|
|
|
+ '''
|
|
|
|
+
|
|
|
|
+ def table_type_insert(self):
|
|
|
|
+ self.shangju_db.update(self.sql_20, self.table_type_info)
|
|
|
|
|
|
def get_rule_id(self, sub_question_id, rule):
|
|
def get_rule_id(self, sub_question_id, rule):
|
|
for re in rule:
|
|
for re in rule:
|
|
@@ -556,7 +588,7 @@ class TongCe:
|
|
:return:
|
|
:return:
|
|
"""
|
|
"""
|
|
match_data = self.get_question_info_from_db()
|
|
match_data = self.get_question_info_from_db()
|
|
- self.linshi_db.truncate('mvp_page_display_match')
|
|
|
|
|
|
+ # self.linshi_db.truncate('mvp_page_display_match')
|
|
self.linshi_db.add_some(self.sql_3, match_data)
|
|
self.linshi_db.add_some(self.sql_3, match_data)
|
|
scores = self.scores()
|
|
scores = self.scores()
|
|
match_data_info = self.get_option_match_info()
|
|
match_data_info = self.get_option_match_info()
|
|
@@ -675,6 +707,15 @@ class TongCe:
|
|
|
|
|
|
return len(update_data)
|
|
return len(update_data)
|
|
|
|
|
|
|
|
+ sql_19 = '''
|
|
|
|
+ select GROUP_CONCAT(id)from f_t_daren_score_2 where testcase_id in (84, 85, 86, 87) and score = 2925 and district = '璧山区'
|
|
|
|
+
|
|
|
|
+ update f_t_daren_score_2 set score = 2926 where id in (979728,979890,981251,984783,985250,985564,990999)
|
|
|
|
+ '''
|
|
|
|
+
|
|
|
|
+ def chongqin_to_bishan(self):
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
tongce = TongCe()
|
|
tongce = TongCe()
|