def test_01_check_xtzt_ajid(self): """根据ajid查询当前案件状态是否正确(n_tbxtzt=102)""" db = DataBase('ga') savedata = SaveResultToFile() ajid = savedata.readfile('平台案件编号') sql = "SELECT n_tbxtzt FROM db_yw.t_tb_ajxx WHERE c_id LIKE '%s'" % ( ajid) xtzt = db.getdata(sql, 0)[1] logger.info("查询到的协同状态:%s" % xtzt) self.assertEqual(102, xtzt) # 断言协同状态是否转换成功
def test_07_set_qzzt(self): """设置签章状态为1,通过ajid查询数据库,设置n_yqz=1""" # 设置签章状态的sql ajid = SaveResultToFile().readfile('ajid') sql = "update db_jz.t_jzgl_wj set n_yqz =1 WHERE c_ywid='%s' and c_store_path is not null" % (ajid) # 链接数据库执行sql db = DataBase("ga") # 链接数据库,选择ga端,数据库信息在ini文件中读取 db.exe_update(sql) # 执行sql sele_sql = "SELECT n_yqz from db_jz.t_jzgl_wj WHERE c_ywid='%s' and c_store_path is not null" % (ajid) result = db.getdata(sele_sql, 0)[1] # 判断是否查询到该ajid的签章状态 self.assertEqual(1, result) # 断言是否执行sql成功
def test_03_assert_result_zf(self): """验证政法端协同状态是否变成104""" # 连接数据库 db = DataBase('zf') savedata = SaveResultToFile() ajid = savedata.readfile('平台案件编号') # 从文件中读取ajid sql = "SELECT n_tbxtzt FROM db_yw.t_tb_ajxx WHERE c_id LIKE '%s'" % ( ajid) xtzt = db.getdata(sql, 0)[1] logger.info("查询到的协同状态:%s" % xtzt) self.assertEqual(104, xtzt)
def getajid(self): db= DataBase("ga") # 查询最新生成的ajid,和当前时间的时间差为3分钟以内 sql ="select c_id from db_yw.t_tb_ajxx ajxx where d_xgsj between " \ "(SELECT current_timestamp - interval '10 minute') and current_timestamp ORDER BY d_xgsj DESC LIMIT 1" \ # "and n_tbxtzt=101" resda =db.getdata(sql,0)[1] if type(resda)==None: logger.info("未查询到该sql的结果") else: logger.info("查询到的ajid:{}".format(resda)) return resda
def test_01_get_xyrxm(self): """获取嫌疑人姓名,并生成pdf文件名称""" savedata = SaveResultToFile() ajid = savedata.readfile('平台案件关联编号') sql_ajcm = "SELECT xyr.c_xyrxm FROM db_yw.t_jc_gaxyr xyr WHERE c_id_ajxx='%s'" % ( ajid) # 通过sql查询ajmc db = DataBase("ga") xyrxm = db.getdata(sql_ajcm, 0)[1] # 执行sql savedata.writefile('嫌疑人姓名', xyrxm) savedata.writefile('处理结果', 1) # 添加106流程的处理结果,用来做替换 savedata.writefile('文件显示名称', "\批准逮捕决定书" + '(' + xyrxm + ')' + '.pdf') # 添加106流程的处理结果,用来做替换 savedata.writefile('文件路径', "\ws" + "\批准逮捕决定书" + '(' + xyrxm + ')' + '.pdf') # 添加106流程的处理结果,用来做替换
def test_09_tb_save_all_data(self): """保存所有数据到logs/record.txt中,至此公安端页面操作结束""" savedata = SaveResultToFile() ajid = savedata.readfile('ajid') xyrxm = savedata.readfile('嫌疑人姓名') self.assertIsNotNone(ajid) # 断言是否读取到ajid savedata.clearfile() # 清除之前的测试数据 savedata.writefile('嫌疑人姓名', xyrxm) db = DataBase("ga") # 链接数据库,选择ga端,数据库信息在ini文件中读取 sql_ajcm = "SELECT ajxx.c_ajmc FROM db_yw.t_ycjy_ajxx ajxx WHERE c_id='%s'" % ( ajid) # 通过sql查询ajmc ajmc = db.getdata(sql_ajcm, 0)[1] # 执行sql savedata.writefile('案件名称', ajmc) savedata.writefile('平台案件编号', ajid) sql_jcajid = "SELECT ajxx.c_jcajid FROM db_yw.t_ycjy_ajxx ajxx WHERE c_id='%s'" % ( ajid) jcajid = db.getdata(sql_jcajid, 0)[1] # 执行sql savedata.writefile('平台案件关联编号', jcajid) sql_jsdw = "SELECT corp.c_alias alise_js FROM db_yw.t_ycjy_ajxx ajxx JOIN db_uim.t_aty_corp corp " \ "ON ajxx.c_sskss = corp.c_id WHERE ajxx.c_id = '%s' " % (ajid) jsdw = db.getdata(sql_jsdw, 0)[1] # 执行sql savedata.writefile('接收单位编号', jsdw) sql_fsdw = "SELECT corp.c_alias alise_fs FROM db_yw.t_ycjy_ajxx ajxx JOIN " \ "db_uim.t_aty_corp corp ON ajxx.c_xtfqdw = corp.c_id WHERE ajxx.c_id = '%s'" % (ajid) fsdw = db.getdata(sql_fsdw, 0)[1] savedata.writefile('发送单位编号', fsdw)
def update_qzzt(self): r = DataBase("ga") # 查询最新生成的ajid g = GetAjid() ajid = g.getajid() if type(ajid) == None: logger.info("未查询到ajid,无法设置签章状态") else: sql = "update db_jz.t_jzgl_wj set n_yqz =1 WHERE c_ywid='%s' and c_store_path is not null" % ( ajid) r.exe_update(sql) r.exe_close()
def test_09_tb_save_all_data(self): """保存所有数据到logs/record.txt中,至此公安端页面操作结束""" savedata = SaveResultToFile() ajid = savedata.readfile('ajid') db = DataBase("ga") # 链接数据库,选择ga端,数据库信息在ini文件中读取 sql_ajcm = "SELECT ajxx.c_ajmc FROM db_yw.t_wshy_hyxx ajxx WHERE c_id='%s'" % ( ajid) # 通过sql查询ajmc ajmc = db.getdata(sql_ajcm, 0)[1] # 执行sql savedata.writefile('案件名称', ajmc) savedata.writefile('平台案件编号', ajid) sql_jcajid = "SELECT ajxx.c_jcajid FROM db_yw.t_wshy_hyxx ajxx WHERE c_id='%s'" % ( ajid) jcajid = db.getdata(sql_jcajid, 0)[1] # 执行sql savedata.writefile('平台案件关联编号', jcajid) sql_jsdw = "SELECT corp.c_alias alise_js FROM db_yw.t_wshy_hyxx ajxx JOIN db_uim.t_aty_corp corp " \ "ON ajxx.c_ysdw = corp.c_id WHERE ajxx.c_id = '%s' " % (ajid) jsdw = db.getdata(sql_jsdw, 0)[1] # 执行sql savedata.writefile('接收单位编号', jsdw) sql_fsdw = "SELECT corp.c_alias alise_fs FROM db_yw.t_wshy_hyxx ajxx JOIN " \ "db_uim.t_aty_corp corp ON ajxx.c_jsdw = corp.c_id WHERE ajxx.c_id = '%s'" % (ajid) fsdw = db.getdata(sql_fsdw, 0)[1] savedata.writefile('发送单位编号', fsdw)