tongce.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. from excel_util import ExcelUtil
  2. from mysql_db import MysqlDB
  3. from itertools import groupby
  4. class TongCe:
  5. """
  6. 同策测试数据清洗
  7. """
  8. # 统计筒体结果
  9. sql_1 = '''
  10. SELECT
  11. a.sub_question_id,
  12. b.sub_question_content,
  13. a.score,
  14. b.sub_option_content,
  15. count(1)
  16. FROM
  17. f_t_daren_score_2 a
  18. LEFT JOIN d_shangju_tiku_02 b ON a. STATUS = b. STATUS = 1
  19. WHERE
  20. a.testcase_id in %s and
  21. a.testcase_id = b.testcase_id
  22. AND a.sub_question_id = b.sub_question_id
  23. AND (
  24. a.score = b.score
  25. OR a.score = b.sub_option_id
  26. )
  27. GROUP BY
  28. b.sub_question_content,
  29. a.score,
  30. b.sub_option_content
  31. '''
  32. # 选项信息
  33. sql_2 = '''
  34. SELECT
  35. b.id as question_id,
  36. b. NAME as question_title,
  37. a.id as sub_question_id,
  38. a. NAME as sub_question_title,
  39. d.id as option_id,
  40. d.content as option_title,
  41. c.id as sub_option_id,
  42. c.content as sub_option_title
  43. FROM
  44. bq_sub_question a
  45. LEFT JOIN bq_question b ON a.father_id = b.id
  46. LEFT JOIN bq_sub_option c ON a.id = c.sub_question_id
  47. LEFT JOIN bq_option d ON c.father_id = d.id
  48. WHERE
  49. FIND_IN_SET(
  50. a.id,
  51. (
  52. SELECT
  53. GROUP_CONCAT(question_ids)
  54. FROM
  55. bq_testcase
  56. WHERE
  57. house_ids = %s
  58. GROUP BY
  59. house_ids
  60. )
  61. )
  62. AND a. STATUS = b. STATUS = c. STATUS = 1
  63. ORDER BY
  64. a.id
  65. '''
  66. # 表
  67. sql_3 = '''
  68. INSERT INTO mvp_page_display_match (
  69. house_id,
  70. question_id,
  71. question_title,
  72. sub_question_id,
  73. sub_question_title,
  74. option_id,
  75. option_content,
  76. sub_option_id,
  77. sub_option_content,
  78. data_item_tab,
  79. data_item_title,
  80. data_item_name,
  81. STATUS,
  82. creator,
  83. created
  84. )
  85. VALUES
  86. (
  87. %s,
  88. %s,
  89. %s,
  90. %s,
  91. %s,
  92. %s,
  93. %s,
  94. %s,
  95. %s,
  96. %s,
  97. %s,
  98. %s,
  99. 1,
  100. 'binren',
  101. now()
  102. )
  103. '''
  104. sql_4 = '''
  105. SELECT
  106. id,
  107. sub_question_id,
  108. sub_option_id,
  109. data_item_name
  110. FROM
  111. mvp_page_display_match
  112. WHERE
  113. STATUS = 1
  114. '''
  115. sql_5 = '''
  116. SELECT
  117. id
  118. FROM
  119. bq_testcase
  120. WHERE
  121. STATUS = 1
  122. AND FIND_IN_SET(
  123. (
  124. SELECT
  125. id
  126. FROM
  127. bq_house
  128. WHERE
  129. STATUS = 1
  130. AND NAME = %s
  131. ),
  132. house_ids
  133. )
  134. '''
  135. sql_6 = '''
  136. insert INTO mvp_page_display_data (
  137. crowd_info_id,
  138. match_id,
  139. page_display_rule_id,
  140. name,
  141. value,
  142. STATUS,
  143. creator,
  144. created
  145. )
  146. VALUES
  147. (%s, %s, %s, %s, %s, 1, 'binren', now())
  148. '''
  149. sql_7 = '''
  150. SELECT
  151. a.testcase_id,
  152. a.uuid,
  153. GROUP_CONCAT(
  154. DISTINCT b.sub_option_content
  155. )
  156. FROM
  157. f_t_daren_score_2 a
  158. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  159. WHERE
  160. a.testcase_id IN (84, 85, 86, 87)
  161. AND b.father_id IN (47, 48, 234, 254)
  162. and a.sub_question_id = b.sub_question_id and a.testcase_id = b.testcase_id
  163. GROUP BY
  164. a.testcase_id,
  165. a.uuid
  166. '''
  167. sql_8 = '''
  168. SELECT
  169. a.uuid,
  170. a.title,
  171. a.testcase_id,
  172. b.father_id,
  173. b.father_content,
  174. b.sub_option_id,
  175. b.sub_option_content
  176. FROM
  177. f_t_daren_score_2 a
  178. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  179. WHERE
  180. a.testcase_id = b.testcase_id
  181. AND a.sub_question_id = b.sub_question_id
  182. AND a.testcase_id IN (84, 85, 86, 87)
  183. '''
  184. sql_9 = '''
  185. SELECT
  186. x.city
  187. ,x.uuid
  188. ,x.sex
  189. ,x.nld
  190. ,x.zhifuli
  191. ,x.juzhujiegou
  192. ,m.father_content
  193. ,m.father_id
  194. ,m.sub_question_id
  195. ,m.sub_question_content
  196. ,m.option_tags as option_id
  197. ,m.father_content as option_content
  198. ,m.sub_option_id
  199. ,m.sub_option_content
  200. ,m.testcase_id
  201. ,m.title
  202. FROM
  203. (
  204. SELECT
  205. e.uuid,
  206. e.sex,
  207. f.nld,
  208. c.zhifuli,
  209. d.city,
  210. w.juzhujiegou
  211. FROM
  212. (
  213. SELECT
  214. a.testcase_id,
  215. a.uuid,
  216. b.sub_option_content AS sex
  217. FROM
  218. f_t_daren_score_2 a
  219. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  220. WHERE
  221. a.testcase_id IN (84, 85, 86, 87)
  222. AND b.father_id = 47
  223. AND a.sub_question_id = b.sub_question_id
  224. AND a.testcase_id = b.testcase_id
  225. GROUP BY
  226. a.testcase_id,
  227. a.uuid
  228. ) e
  229. LEFT JOIN (
  230. SELECT
  231. a.uuid,
  232. b.sub_option_content AS nld
  233. FROM
  234. f_t_daren_score_2 a
  235. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  236. WHERE
  237. a.testcase_id IN (84, 85, 86, 87)
  238. AND b.father_id = 48
  239. AND a.sub_question_id = b.sub_question_id
  240. AND a.testcase_id = b.testcase_id
  241. GROUP BY
  242. a.testcase_id,
  243. a.uuid
  244. ) f ON e.uuid = f.uuid
  245. LEFT JOIN (
  246. SELECT
  247. a.uuid,
  248. b.sub_option_content AS zhifuli
  249. FROM
  250. f_t_daren_score_2 a
  251. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  252. WHERE
  253. a.testcase_id IN (84, 85, 86, 87)
  254. AND b.father_id = 234
  255. AND a.sub_question_id = b.sub_question_id
  256. AND a.testcase_id = b.testcase_id
  257. GROUP BY
  258. a.testcase_id,
  259. a.uuid
  260. ) c ON f.uuid = c.uuid
  261. LEFT JOIN (
  262. SELECT
  263. a.uuid,
  264. b.sub_option_content AS city
  265. FROM
  266. f_t_daren_score_2 a
  267. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  268. WHERE
  269. a.testcase_id IN (84, 85, 86, 87)
  270. AND b.father_id = 254
  271. AND a.sub_question_id = b.sub_question_id
  272. AND a.testcase_id = b.testcase_id
  273. GROUP BY
  274. a.testcase_id,
  275. a.uuid
  276. ) d ON c.uuid = d.uuid
  277. left join (
  278. SELECT
  279. a.uuid,
  280. b.sub_option_content AS juzhujiegou
  281. FROM
  282. f_t_daren_score_2 a
  283. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  284. WHERE
  285. a.testcase_id IN (84, 85, 86, 87)
  286. AND b.father_id = 211
  287. AND a.sub_question_id = b.sub_question_id
  288. AND a.testcase_id = b.testcase_id
  289. GROUP BY
  290. a.testcase_id,
  291. a.uuid
  292. ) w on d.uuid = w.uuid
  293. ) x
  294. LEFT JOIN (
  295. SELECT
  296. a.uuid,
  297. a.title,
  298. a.testcase_id,
  299. b.father_id,
  300. b.father_content,
  301. b.sub_question_id,
  302. b.sub_question_content,
  303. b.sub_option_id,
  304. b.sub_option_content,
  305. b.option_tags
  306. FROM
  307. f_t_daren_score_2 a
  308. LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
  309. WHERE
  310. a.testcase_id = b.testcase_id
  311. AND a.sub_question_id = b.sub_question_id
  312. AND a.testcase_id IN (84, 85, 86, 87)
  313. ) m ON x.uuid = m.uuid
  314. '''
  315. sql_10 = '''
  316. INSERT INTO f_t_daren_score_2 (
  317. testcase_id,
  318. title,
  319. uuid, score, created, sub_question_id
  320. )
  321. VALUE
  322. (84, '有钱人的生活就是很枯燥的……', %s, %s, %s, %s)
  323. '''
  324. sql_11 = '''
  325. select id, title_type, title_in_page, sub_question_id from mvp_page_display_rule where status = 1
  326. '''
  327. sql_12 = '''
  328. INSERT INTO mvp_page_display_rule (
  329. house_id,
  330. function_id,
  331. title_type,
  332. title_in_page,
  333. sub_question_id,
  334. STATUS,
  335. creator,
  336. created
  337. )
  338. VALUE
  339. (
  340. 67,
  341. 1,
  342. %s,
  343. %s,
  344. %s,
  345. 1,
  346. 'binren',
  347. now()
  348. )
  349. '''
  350. sql_13 = '''
  351. INSERT INTO mvp_crowd_info (
  352. house_id,
  353. pay_ability,
  354. age_area,
  355. city_name,
  356. life_cycle,
  357. STATUS,
  358. creator,
  359. created
  360. )
  361. VALUES
  362. (
  363. 67,
  364. %s,
  365. %s,
  366. %s,
  367. %s,
  368. 1,
  369. 'binren',
  370. now()
  371. )
  372. '''
  373. def __init__(self):
  374. self.shangju_db = MysqlDB('shangju')
  375. self.marketing_db = MysqlDB('bi_report')
  376. self.linshi_db = MysqlDB('linshi', db_type=1)
  377. self.options_info = ExcelUtil('工作表6', 'tongce.xlsx').read_options_info()
  378. self.table_type_info = ExcelUtil('新增项目数据项类型排序与展示图表类型管理表', 'table_type.xlsx').get_table_type_info()
  379. def close(self):
  380. self.shangju_db.close()
  381. self.linshi_db.close()
  382. self.marketing_db.close()
  383. def get_question_info_from_db(self):
  384. result = self.shangju_db.select(self.sql_2, [67])
  385. insert_data = []
  386. for rt in result:
  387. rt = list(rt)
  388. option_configuration = self.options_info.get('67' + str(rt[6]))
  389. if option_configuration and len(option_configuration) == 4:
  390. rt.insert(0, 67)
  391. rt.extend(option_configuration[0:3])
  392. insert_data.append(rt)
  393. return insert_data
  394. def get_option_match_info(self):
  395. result = self.linshi_db.select(self.sql_4)
  396. return result
  397. # 支付力:376,年龄:29,城市:377,居住结构:395。
  398. sql_14 = '''
  399. select content from bq_sub_option where sub_question_id = %s
  400. '''
  401. def insert_into_mvp_crowd_info(self):
  402. zhifuli = self.shangju_db.select(self.sql_14, [376])
  403. age = self.shangju_db.select(self.sql_14, [29])
  404. city = self.shangju_db.select(self.sql_14, [377])
  405. juzhujiegou = self.shangju_db.select(self.sql_14, [395])
  406. insert_data = []
  407. for zfl in zhifuli:
  408. for a in age:
  409. for cy in city:
  410. for jzjg in juzhujiegou:
  411. insert_data.append([zfl, a, cy, jzjg])
  412. if len(insert_data) > 0:
  413. # self.linshi_db.truncate('mvp_crowd_info')
  414. self.linshi_db.add_some(self.sql_13, insert_data)
  415. sql_15 = '''
  416. select id, pay_ability, age_area, city_name, life_cycle from mvp_crowd_info where status = 1 and house_id = 67
  417. '''
  418. def get_crowd_info(self):
  419. data = self.linshi_db.select(self.sql_15)
  420. return data
  421. def insert_into_rule(self):
  422. option_info = self.options_info
  423. insert_data = []
  424. sub_question_ids = []
  425. for key in option_info.keys():
  426. data = option_info[key]
  427. if data[3] not in sub_question_ids:
  428. insert_data.append([data[0], data[1], data[3]])
  429. sub_question_ids.append(data[3])
  430. if len(insert_data) > 0:
  431. self.linshi_db.truncate('mvp_page_display_rule')
  432. self.linshi_db.add_some(self.sql_12, insert_data)
  433. def get_rule_data_info(self):
  434. data = self.linshi_db.select(self.sql_11)
  435. return data
  436. sql_16 = '''
  437. insert INTO mvp_page_display_data (
  438. crowd_info_id,
  439. match_id,
  440. value,
  441. STATUS,
  442. creator,
  443. created
  444. )
  445. VALUES
  446. (%s, %s, %s, 1, 'binren', now())
  447. '''
  448. def lingdi_data_scores(self):
  449. # 1: 写入mvp_crowd_info
  450. # self.insert_into_mvp_crowd_info()
  451. crowd_info = self.get_crowd_info()
  452. # 2: 写入rule
  453. # self.insert_into_rule()
  454. rule = self.get_rule_data_info()
  455. # 3: 读入答题数据
  456. self.answers = self.marketing_db.select(self.sql_9)
  457. # 4: 写入match信息
  458. match_data = self.get_question_info_from_db()
  459. # self.linshi_db.truncate('mvp_page_display_match')
  460. # self.linshi_db.add_some(self.sql_3, match_data)
  461. self.match_data_info = self.get_option_match_info()
  462. self.linshi_db.truncate('mvp_page_display_data')
  463. # 筛选写入data的数据
  464. count = 0
  465. no_data_case = []
  466. for ci in crowd_info:
  467. insert_data = []
  468. crowd_info_id = ci[0]
  469. zhifuli = ci[1]
  470. age = ci[2]
  471. city = ci[3]
  472. juzhujiegou = ci[4]
  473. data = self.filter_people(city, age, zhifuli, juzhujiegou)
  474. data.sort(key=lambda obj: obj[0])
  475. for key, questions_data in groupby(data, key=lambda obj: obj[0]):
  476. question_data_list = []
  477. for qd in questions_data:
  478. question_data_list.append([x for x in qd])
  479. rule_id = self.get_rule_id(key, rule)
  480. if rule_id is not None:
  481. question_people = len(question_data_list)
  482. if question_people > 0:
  483. question_data_list.sort(key=lambda obj: obj[3])
  484. for option_name, option_data_1 in groupby(question_data_list, key=lambda obj: obj[3]):
  485. option_data_list = []
  486. for od in option_data_1:
  487. option_data_list.append([x for x in od])
  488. if len(option_data_list) > 0:
  489. match_id = 0
  490. option_name_alias = option_name
  491. option_id = option_data_list[0][2]
  492. for md in self.match_data_info:
  493. if str(md[1]) == str(key) and str(md[2]) == str(option_id):
  494. match_id = md[0]
  495. option_name_alias = md[3]
  496. insert_data.append([crowd_info_id, match_id, rule_id, option_name_alias, len(option_data_list)])
  497. else:
  498. no_data_case.append([zhifuli, city, age, juzhujiegou, option_name])
  499. else:
  500. no_data_case.append([zhifuli, city, age, juzhujiegou, key])
  501. count += len(insert_data)
  502. self.linshi_db.add_some(self.sql_6, insert_data)
  503. isnert_data_all = []
  504. quanliang_scores = self.scores()
  505. for q_s in quanliang_scores:
  506. rule_id = self.get_rule_id(q_s[0], rule)
  507. if rule_id:
  508. for md in self.match_data_info:
  509. if str(md[1]) == str(q_s[0]) and str(md[2]) == str(q_s[1]):
  510. match_id = md[0]
  511. option_name_alias = md[3]
  512. isnert_data_all.append([5405, match_id, rule_id, option_name_alias, q_s[2]])
  513. self.linshi_db.add_some(self.sql_6, isnert_data_all)
  514. count += len(isnert_data_all)
  515. return {'写入库中的数据': count, '无数据': len(no_data_case)}
  516. sql_20 = '''
  517. UPDATE mvp_page_display_rule
  518. SET display_type = %s,
  519. display_size = %s
  520. WHERE
  521. title_in_page = %s
  522. '''
  523. def table_type_insert(self):
  524. for data in self.table_type_info:
  525. self.linshi_db.update(self.sql_20, data)
  526. def get_rule_id(self, sub_question_id, rule):
  527. for re in rule:
  528. if str(re[3]) == str(sub_question_id):
  529. return re[0]
  530. def filter_people(self, city, age, zhifuli, juzhujiegou):
  531. result = []
  532. for answer in self.answers:
  533. if answer[0] == city and answer[3] == age and answer[4] == zhifuli and answer[5] == juzhujiegou:
  534. # 子题id, 子题题目,子选项id,子选项题目
  535. result.append([answer[8], answer[9], answer[12], answer[13]])
  536. return result
  537. def get_testcase_ids_by_house_name(self, house_name):
  538. testcase_ids = self.shangju_db.select(self.sql_5, [house_name])
  539. return testcase_ids
  540. def scores(self):
  541. testcase_ids = self.get_testcase_ids_by_house_name('同策 领地')
  542. db_data = self.marketing_db.select(self.sql_1, [testcase_ids])
  543. answer = []
  544. for data in db_data:
  545. answer.append([data[0], data[2], data[4]])
  546. answer.sort(key=lambda obj: obj[0])
  547. sub_option_score = []
  548. for sub_question_id, others in groupby(answer, key=lambda obj: obj[0]):
  549. others_data = []
  550. for ot in others:
  551. others_data.append([x for x in ot])
  552. sub_question_count = sum([x[2] for x in others_data])
  553. for td in others_data:
  554. sub_option_id = td[1]
  555. sub_option_count = td[2]
  556. rate = int(sub_option_count) / sub_question_count
  557. sub_option_score.append([sub_question_id, sub_option_id, sub_option_count])
  558. return sub_option_score
  559. def tongce(self):
  560. """
  561. tongce测试数据清洗
  562. :return:
  563. """
  564. match_data = self.get_question_info_from_db()
  565. # self.linshi_db.truncate('mvp_page_display_match')
  566. self.linshi_db.add_some(self.sql_3, match_data)
  567. scores = self.scores()
  568. match_data_info = self.get_option_match_info()
  569. dispaly_data = []
  570. for score in scores:
  571. sub_question_id = score[0]
  572. sub_option_id = score[1]
  573. value = score[2]
  574. for mi in match_data_info:
  575. if str(mi[1]) == str(sub_question_id) and str(mi[2]) == str(sub_option_id):
  576. dispaly_data.append([mi[0], value])
  577. if len(dispaly_data) > 0:
  578. self.linshi_db.truncate('mvp_page_display_data')
  579. self.linshi_db.add_some(self.sql_6, dispaly_data)
  580. return {'插入数据条数': len(dispaly_data), 'scores': dispaly_data}
  581. def wenjuanxin_84(self):
  582. excel = ExcelUtil('Sheet1', '84_1500.xlsx')
  583. insert_data = excel.wenjuanxin_84()
  584. self.linshi_db.add_some(self.sql_10, insert_data)
  585. print()
  586. sql_17 = '''
  587. SELECT
  588. id,
  589. uuid,
  590. created,
  591. `status`,
  592. sub_question_id,
  593. testcase_id,
  594. title,
  595. score,
  596. province,
  597. city,
  598. district
  599. FROM
  600. f_t_daren_score_2
  601. WHERE
  602. testcase_id IN (84, 85, 86, 87)
  603. AND sub_question_id = 377
  604. AND score = 2917
  605. AND (
  606. city IN (
  607. '昆明市',
  608. '西安市',
  609. '咸阳市',
  610. '郑州市',
  611. '洛阳市',
  612. '武汉市',
  613. '襄阳市',
  614. '重庆市',
  615. '璧山'
  616. )
  617. OR province IN (
  618. '昆明市',
  619. '西安市',
  620. '咸阳市',
  621. '郑州市',
  622. '洛阳市',
  623. '武汉市',
  624. '襄阳市',
  625. '重庆市',
  626. '璧山'
  627. )
  628. OR district IN (
  629. '昆明市',
  630. '西安市',
  631. '咸阳市',
  632. '郑州市',
  633. '洛阳市',
  634. '武汉市',
  635. '襄阳市',
  636. '重庆市',
  637. '璧山区'
  638. )
  639. )
  640. '''
  641. sql_18 = '''
  642. update f_t_daren_score_2 set score = %s where id = %s
  643. '''
  644. city_info = {
  645. '昆明市': 2918,
  646. '西安市': 2919,
  647. '咸阳市': 2920,
  648. '郑州市': 2921,
  649. '洛阳市': 2922,
  650. '武汉市': 2923,
  651. '襄阳市': 2924,
  652. '重庆市': 2925,
  653. '璧山市': 2926
  654. }
  655. def other_city_clean(self):
  656. update_data = []
  657. need_update_data = self.marketing_db.select(self.sql_17)
  658. for nd in need_update_data:
  659. id = nd[0]
  660. province = nd[8]
  661. city = nd[9]
  662. district = nd[10]
  663. bishan = self.city_info.get(district)
  664. if bishan:
  665. update_data.append([bishan, id])
  666. else:
  667. city_id = self.city_info.get(city)
  668. if city_id:
  669. update_data.append([city_id, id])
  670. else:
  671. province_id = self.city_info.get(province)
  672. if province_id:
  673. update_data.append([province_id, id])
  674. self.marketing_db.add_some(self.sql_18, update_data)
  675. return len(update_data)
  676. sql_19 = '''
  677. select GROUP_CONCAT(id)from f_t_daren_score_2 where testcase_id in (84, 85, 86, 87) and score = 2925 and district = '璧山区'
  678. update f_t_daren_score_2 set score = 2926 where id in (979728,979890,981251,984783,985250,985564,990999)
  679. '''
  680. def chongqin_to_bishan(self):
  681. pass
  682. if __name__ == '__main__':
  683. tongce = TongCe()
  684. tongce.insert_into_rule()