Esempio n. 1
0
def change_password(id):
    if request.method == 'POST':
        try:
            user = User.query.filter_by(id=id).first()
            if user.login_password == GetStringMD5(request.form['old_password']):
                user.login_password = GetStringMD5(request.form['login_password'])
            else:
                raise Exception

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('修改密码成功,请重新登录!','success')

        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('修改密码失败,为保障账号安全,请重新登录后再尝试修改!','error')

        logout_user()
        return redirect("login")
    else:
        return render_template("change_password.html")
Esempio n. 2
0
def edit_role(id):
    if request.method == 'POST':
        try:
            chk = Role.query.filter("role_name='"+request.form['role_name']+"' and id<>"+str(id)).all()
            if(chk):
                # 消息闪现
                flash('保存失败,角色名重复','error')
                return redirect('System/role.page/1')
            
            Role.query.filter_by(id=id).update({"role_name":request.form['role_name']})

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        finally:
            xmlUtil.updateDynDict('role_all')

        return redirect('System/role.page/1')

    elif request.method == 'GET':
        role = Role.query.filter_by(id=id).first()

        return render_template("System/role/edit_role.html",role=role)
Esempio n. 3
0
def change_belong_user():
    try:
        user = User.query.filter_by(id=request.form['user_id']).first()
        user.org_id = None
        user.pId = request.form['belong_user']
        
        sql = "FIND_IN_SET(id ,getUserList('"+request.form['user_id']+"'))"
        users = User.query.filter(sql).order_by("id").all()
        for obj in users:
            if str(obj.id) == request.form['belong_user']:#环状结构 不允许
                # 消息闪现
                flash('保存失败 不允许环状结构! ','error')
                return render_template("System/user/user.html")
            
        # 事务提交
        db.session.commit() 
        # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    
    return render_template("System/user/user.html")
Esempio n. 4
0
def new_role():
    if request.method == 'POST':
        try:
            chk = Role.query.filter_by(role_name=request.form['role_name']).all()
            if(chk):
                # 消息闪现
                flash('保存失败,角色名重复','error')
                return redirect('System/role.page/1')
            
            # 保存角色
            Role(request.form['role_name']).add()

            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        finally:
            xmlUtil.updateDynDict('role_all')

        return redirect('System/role.page/1')

    elif request.method == 'GET':
        return render_template("System/role/new_role.html")
Esempio n. 5
0
def save_pgjl_info(id):
    try:
        info = Rcs_Application_Info.query.filter_by(id=id).first()
        last_advice = request.form['last_advice']
        last_approve = request.form['last_approve']
        approve_advice = request.form['advice_end']
        advice = Rcs_Application_Advice.query.filter_by(application_id=id,user_id=current_user.id).first()
        if advice:
            advice.approve_result = last_advice
            advice.approve_ed = last_approve
        else:
            Rcs_Application_Advice(id,approve_advice,last_advice,last_approve,"2").add()
        #进件标志
        info.approve_type=Application_Type_Finish
        #保存进件日志
        Rcs_Application_Log(id,info.customer_id,info.customer_name,last_advice,last_approve).add()
        #保存缺席专家日志
        #未评估专家
        expert = Rcs_Application_Expert.query.filter("application_id="+str(id)+" and expert_id not in (select user_id from rcs_application_advice where application_id="+str(id)+")").all()
        for obj in expert:
            Rcs_Application_Absent(id,info.card_id,info.customer_name,obj.expert_id,obj.rcs_expert_ibfk_1.real_name).add()
        db.session.commit()
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return redirect("/zxpgjl/pgjl_info/"+str(id))
Esempio n. 6
0
def new_zjxxgl_save():    
    try:
        user_name = request.form['user_name']   
        sex = request.form['sex']   
        card_id = request.form['card_id']   
        phone = request.form['phone']   
        level = request.form['level']
        org = request.form['org']

        address = request.form['address']
        hy = request.form['hy']
        qy = request.form['qy']
        product = request.form['product']
        balance = request.form['balance']
        zyzc = request.form['zyzc']
        xrzw = request.form['xrzw']
        expert_level = request.form['expert_level']
        approve_role = request.form['approve_role']
        gzr = request.form['gzr']
        gzsd = request.form['gzsd']
        user = User(user_name,GetStringMD5('111111'),user_name,sex,phone,1,'',card_id,level,org,None)
        user.add()
        db.session.flush()
        Rcs_Expert_Information(user.id,address,hy,qy,product,balance,zyzc,xrzw,expert_level,approve_role,gzr,gzsd).add() 
        db.session.commit()
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return redirect('/pgzjgl/zjxxgl/1')
Esempio n. 7
0
def interface_test_save():
    companyName = request.form['companyName']
    companyAbbr = request.form['companyAbbr']
    contactPhone = request.form['contactPhone']
    filingNumber = request.form['filingNumber']
    companyAddress = request.form['companyAddress']

    httpClient = None
    try:
        params = urllib.urlencode({'companyName': companyName, 'companyAbbr': companyAbbr,'contactPhone': contactPhone,
            'filingNumber': filingNumber,'companyAddress': companyAddress})
        headers = {"Content-type": "application/x-www-form-urlencoded"
                        , "Accept": "text/plain"}
     
        httpClient = httplib.HTTPConnection("139.196.50.242/jbda/qkInterface/syncInstitution.do", 80, timeout=30)
        httpClient.request("POST", "/PCCredit/ipad/customerInfor/insert.json", params, headers)
        response = httpClient.getresponse().read()
        if "errorcode" in response or response is None:  
            flash('同步失败','error')
        else:
            content = json.loads(response)
            #返回状态
            org_status = content["status"].encode("utf-8")
            if str(org_status)=='0':
                byCompanyCode = content["byCompanyCode"].encode("utf-8")
                OrgTest(companyName,companyAbbr,contactPhone,filingNumber,companyAddress,byCompanyCode).add()
                db.session.commit()
                flash('同步成功','success')
    except:
        logger.exception('exception')
    finally:
        if httpClient:
            httpClient.close()

    return render_template("jbdaInterface/interface_test.html")
Esempio n. 8
0
def save_advice(application_id):
    try:
        result = request.form['result']
        advice = request.form['advice']
        je = request.form['je']
        info = Rcs_Application_Info.query.filter_by(id=application_id).first()
        rcs = Rcs_Application_Advice.query.filter_by(application_id=info.id,user_id=current_user.id).first()
        if rcs:
            rcs.approve_advice = advice
            rcs.approve_result = result
            rcs.approve_ed = je
            #普通专家
            rcs.advice_type = "1"
        else:
            Rcs_Application_Advice(info.id,advice,result,je,"1").add()
        expert = Rcs_Application_Expert.query.filter_by(application_id=info.id,expert_id=current_user.id).first()
        if expert:
            #设置专家已完成此进件评估
            expert.operate = 1
        #保存进件日志
        Rcs_Application_Log(application_id,info.card_id,info.customer_name,result,je).add()
        db.session.commit()
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return redirect("Process/dqdc/show_advice.page/"+str(application_id))
Esempio n. 9
0
def xxlr_syb_bz_save(loan_apply_id):
	try:
		xxlr.xxlr_syb_bz_save(loan_apply_id,request)
		
		return helpers.show_result_success("")
	except:
		logger.exception('exception')
	
		return helpers.show_result_fail("")
Esempio n. 10
0
def new_user(pId):
    if request.method == 'GET':
        roles = Role.query.order_by("id").all()
        return render_template("System/user/new_user.html",roles=roles,pId=pId)
    else:
        try:
            chk = User.query.filter_by(login_name=request.form['login_name']).all()
            if(chk):
                # 消息闪现
                flash('保存失败,登录名重复','error')
                return redirect('System/user.page/1')
            level = request.form['level']
            if('user' in pId):
                user = User(request.form['login_name'],GetStringMD5(request.form['login_password']),
                    request.form['real_name'],request.form['sex'],request.form['mobile'],request.form['active'],request.form['email'],request.form['card_id'],level,
                    None,int(pId.split("_")[1]))
                user.add()
            else:
                user = User(request.form['login_name'],GetStringMD5(request.form['login_password']),
                    request.form['real_name'],request.form['sex'],request.form['mobile'],request.form['active'],request.form['email'],request.form['card_id'],level,
                    int(pId.split("_")[1]),None)
                user.add()

            #清理缓存
            db.session.flush()
            UserRole(user.id,request.form['roles']).add()

            
            # 专家
            if level!='3':
                #专家信息
                address = request.form['address']
                hy = request.form['hy']
                qy = request.form['qy']
                product = request.form['product']
                balance = request.form['balance']
                zyzc = request.form['zyzc']
                xrzw = request.form['xrzw']
                expert_level = request.form['expert_level']
                approve_role = request.form['approve_role']
                gzr = request.form['gzr']
                gzsd = request.form['gzsd']
                Rcs_Expert_Information(user.id,address,hy,qy,product,balance,zyzc,xrzw,expert_level,approve_role,gzr,gzsd).add() 
            # 事务提交
            db.session.commit()
            # 消息闪现
            flash('保存成功','success')
        except:
            # 回滚
            db.session.rollback()
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        finally:
            xmlUtil.updateDynDict('user_all')
    return redirect('System/user.page/1')
Esempio n. 11
0
def xxlr_upload_image(loan_apply_id):
	try:
		xxlr.upload_image(loan_apply_id,request)
		# 消息闪现
		flash('保存成功','success')
	except:
		logger.exception('exception')
		# 消息闪现
		flash('保存失败','error')
	return redirect("/xxlr/image_list.page/"+str(loan_apply_id)+"/1/write")
Esempio n. 12
0
def accessright_save_json(roleId):
    try:
        decodejson = json.loads(request.form['nodesJsonStr'])
        access_right.accessright_save_json(roleId, decodejson)
        # 消息闪现
        flash('保存成功','success')
        return helpers.show_result_success('') # 返回json
    except:
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
        return helpers.show_result_fail('') # 返回json
Esempio n. 13
0
def edit_zjxxgl_save(id):  
    try:  
        #获取专家信息 
        user = User.query.filter_by(id=id).first()   
        user_information = Rcs_Expert_Information.query.filter_by(expert_id=id).first()
        user_name = request.form['user_name']   
        sex = request.form['sex']   
        card_id = request.form['card_id']   
        mobile = request.form['phone']   
        level = request.form['level']
        org = request.form['org']

        address = request.form['address']
        hy = request.form['hy']
        qy = request.form['qy']
        product = request.form['product']
        balance = request.form['balance']
        zyzc = request.form['zyzc']
        xrzw = request.form['xrzw']
        expert_level = request.form['expert_level']
        approve_role = request.form['approve_role']
        gzr = request.form['gzr']
        gzsd = request.form['gzsd']
        user.login_name=user_name
        user.real_name=user_name
        user.sex=sex
        user.card_id=card_id
        user.mobile=mobile
        user.user_type=level
        user.org_id=org

        user_information.address=address
        user_information.hy=hy
        user_information.qy=qy
        user_information.product=product
        user_information.balance=balance
        user_information.zyzc=zyzc
        user_information.xrzw=xrzw
        user_information.expert_level=expert_level
        user_information.approve_role=approve_role
        user_information.gzr=gzr
        user_information.gzsd=gzsd
      
        db.session.commit()
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return redirect('/pgzjgl/zjxxgl')
Esempio n. 14
0
def excel_import():
    if request.method == 'POST':
        try:
            pldr.excel_import(request)
            # 消息闪现
            flash('保存成功','success')
        except:
            logger.exception('exception')
            # 消息闪现
            flash('保存失败','error')
        return redirect("/mxpg/pldr/1")
    else:
        return redirect("/mxpg/pldr/1")
Esempio n. 15
0
	def _deco(*args, **kwargs):
		try:
			func(*args, **kwargs)
			db.session.commit()
			# 消息闪现
			flash('保存成功','success')
		except Exception:
			# 回滚
			db.session.rollback()
			logger.exception('exception')
			# 消息闪现
			flash('保存失败','error')
		return render_template("errors/500.html",error=Exception)
Esempio n. 16
0
def save_jjfa():
    try:
        name = request.form['name']
        card_id = request.form['card_id']
        index_id = request.form['index_id']
        bank_id = request.form['bank_id']
        place_all = ''
        place_all_name = ''
        #联动1
        regPermResidence_1 = request.form['regPermResidence_1']
        indiv = Indiv_Brt_Place.query.filter_by(type_code=regPermResidence_1.split('_')[1]).first()
        place_all_name+=indiv.type_name
        place_all+=regPermResidence_1.split('_')[1]
        place = Indiv_Brt_Place.query.filter_by(parent_code=regPermResidence_1.split('_')[1]).first()
        if place:
            #联动2
            regPermResidence_2 = request.form['regPermResidence_2']
            indiv_1 = Indiv_Brt_Place.query.filter_by(type_code=regPermResidence_2.split('_')[1]).first()
            place_all+="|"+regPermResidence_2.split('_')[1]
            place_all_name+=indiv_1.type_name
            place_2 = Indiv_Brt_Place.query.filter_by(parent_code=regPermResidence_2.split('_')[1]).first()
            if place_2:
                regPermResidence_3 = request.form['regPermResidence_3']
                indiv_2 = Indiv_Brt_Place.query.filter_by(type_code=regPermResidence_3.split('_')[1]).first()
                place_all+="|"+regPermResidence_3.split('_')[1]
                place_all_name+=indiv_2.type_name
 
        org_id = request.form['org_id']
        industry_id = request.form['industry_id']
        district_id = request.form['district_id']
        product_id = request.form['product_id']
        approve_limit = request.form['approve_limit']
        manager_id = request.form['manager_id']
        sh_user = request.form['sh_user']
        sp_user = request.form['sp_user']
        #进件状态为1
        approve_type = '1'
        #进件模型类型,未定义
        model_type=0
        Rcs_Application_Info(index_id,name,card_id,product_id,approve_limit,org_id,place_all_name,place_all,industry_id,district_id,manager_id,sh_user,sp_user,approve_type,model_type,None).add()
        db.session.commit()
        # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')

    return redirect("/jjrwfa/jjfa/1")
Esempio n. 17
0
def cspz_hknl_save(score):
    try:
        Rcs_Parameter.query.filter_by(parameter_name="hknl").delete()
        Rcs_Parameter("hknl",score).add()
        db.session.commit()
    # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return redirect("/mxpg/cspz_hknl")
Esempio n. 18
0
def xxlr_hknl_bz(loan_apply_id):
	try:
		xxlr.compute_hknl_bz(loan_apply_id)
	except:
		logger.exception('exception')
		
	sc_application_hknl = SC_Application_Hknl.query.filter_by(loan_apply_id=loan_apply_id).first()
	#取出还款能力旧数据
	form_data = {}
	if(sc_application_hknl):
		tmp = sc_application_hknl.form_data
		for key_value in tmp.split('&'):
			form_data[key_value.split("=")[0]]=key_value.split("=")[1]
	return render_template("xxlr/hknl_bz.html",loan_apply_id=loan_apply_id,form_data=form_data)
def edit_select_delete(p_id):
	select = Rcs_Parameter_Select.query.filter_by(id=p_id).first()
	tree = Rcs_Parameter_Tree.query.filter_by(id=select.tree_id).first()
	Rcs_Parameter_Select.query.filter_by(id=p_id).delete()
	try:
		db.session.commit()
		# 消息闪现
		flash('删除成功','success')
	except:
		# 回滚
		db.session.rollback()
		logger.exception('exception')
		# 消息闪现
		flash('删除失败','error')
	return redirect("/parameter/model_"+tree.param_type)
def add_select_save(p_id):
	try:
		tree = Rcs_Parameter_Tree.query.filter_by(id=p_id).first()
		name = request.form["name"]
		score = request.form["score"]
		Rcs_Parameter_Select(p_id,name,score).add()
		db.session.commit()
		# 消息闪现
		flash('保存成功','success')
	except:
		# 回滚
		db.session.rollback()
		logger.exception('exception')
		# 消息闪现
		flash('保存失败','error')
	return redirect("/parameter/model_"+tree.param_type)
Esempio n. 21
0
def change_belong_org():
    try:
        user = User.query.filter_by(id=request.form['user_id']).first()
        user.pId = None
        user.org_id = request.form['belong_org']
        # 事务提交
        db.session.commit()
        # 消息闪现
        flash('保存成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
    return render_template("System/user/user.html")
def add_tree_save(p_id):
	try:
		name = request.form["name"]
		weight = request.form["weight"]
		tree = Rcs_Parameter_Tree.query.filter_by(id=p_id).first()
		Rcs_Parameter_Tree(tree.param_type,name,p_id,weight,int(tree.level_type)+1).add()
		db.session.commit()
		# 消息闪现
		flash('保存成功','success')
	except:
		# 回滚
		db.session.rollback()
		logger.exception('exception')
		# 消息闪现
		flash('保存失败','error')
	return redirect("/parameter/model_"+tree.param_type)
def autoChild(p_id):
	tree = Rcs_Parameter_Tree.query.filter_by(pId=p_id).all()
	if tree:
		return "false"
	else:
		try:
			Rcs_Parameter_Tree.query.filter_by(id=p_id).delete()
			db.session.commit()
			# 消息闪现
			flash('保存成功','success')
		except:
		    # 回滚
		    db.session.rollback()
		    logger.exception('exception')
		    # 消息闪现
		    flash('保存失败','error')
		return "true"
def edit_tree_save(p_id):
	try:
		name = request.form["name"]
		weight = request.form["weight"]
		tree = Rcs_Parameter_Tree.query.filter_by(id=p_id).first()
		tree.name = name
		tree.weight = weight
		db.session.commit()
		# 消息闪现
		flash('修改成功','success')
	except:
		# 回滚
		db.session.rollback()
		logger.exception('exception')
		# 消息闪现
		flash('修改失败','error')
	return redirect("/parameter/model_"+tree.param_type)
Esempio n. 25
0
def delete_role(id):
    try:
        UserRole.query.filter_by(role_id=id).delete()
        Role.query.filter_by(id=id).delete()
        
        # 事务提交
        db.session.commit()
        # 消息闪现
        flash('删除成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('删除失败','error')
    finally:
        xmlUtil.updateDynDict('role_all')
    return ''
def edit_select_save(p_id):
	
	name = request.form["name"]
	score = request.form["score"]
	select = Rcs_Parameter_Select.query.filter_by(id=p_id).first()
	select.name = name
	select.score = score
	tree = Rcs_Parameter_Tree.query.filter_by(id=select.tree_id).first()
	try:
		db.session.commit()
		# 消息闪现
		flash('修改成功','success')
	except:
		# 回滚
		db.session.rollback()
		logger.exception('exception')
		# 消息闪现
		flash('修改失败','error')
	return redirect("/parameter/model_"+tree.param_type)
Esempio n. 27
0
def disable_user(type,id):
    try:
        user = User.query.filter_by(id=id).first()
        user.active = type
        
        # 事务提交
        db.session.commit()
        # 消息闪现
        flash('保存成功','success')
        return helpers.show_result_success('保存成功')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('保存失败','error')
        return helpers.show_result_fail('保存失败')
    finally:
        xmlUtil.updateDynDict('user_all')
Esempio n. 28
0
def refuse():
    try:
        id = request.form['hiddenId']
        refuse_reason = request.form['refuse_reason']
        #删除进件关系表
        Rcs_Application_Expert.query.filter_by(application_id=id,expert_id=current_user.id).delete()
        db.session.flush()
        info = Rcs_Application_Info.query.filter_by(id=id).first()
        Rcs_Expert_Refuse(current_user.id,current_user.real_name,id,info.customer_name,refuse_reason,None,'').add()
        db.session.commit()
    # 消息闪现
        flash('拒绝成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('拒绝失败','error')
    return redirect("zjzxpggl/yjsrw/1")
Esempio n. 29
0
def has_refuse_save():
    try:
        id = request.form['hiddenId']
        expert_id = request.form['expert']
        refuse = Rcs_Expert_Refuse.query.filter_by(id=id).first()
        users = User.query.filter_by(id=expert_id).first()
        refuse.new_expert_id = expert_id
        refuse.new_expert_name = users.real_name
        #进件关系表添加记录
        Rcs_Application_Expert(refuse.application_id,expert_id).add()
        db.session.commit()
    # 消息闪现
        flash('重分配成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('重分配失败','error')
    return redirect("/zjzxpggl/has_refuse/1")
Esempio n. 30
0
def cancel_save(id):
    try:
        #删除未评估专家
        Rcs_Application_Expert.query.filter_by(application_id=id,operate=0).delete()
        db.session.flush()
        #重新保存评估专家
        expertId = request.form.getlist('expert')
        for obj in expertId:
            #判断是否重复
            expert = Rcs_Application_Expert.query.filter_by(application_id=id,expert_id=obj).first()
            if not expert:
                Rcs_Application_Expert(id,int(obj)).add()
        db.session.commit()
        flash('撤销成功','success')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        # 消息闪现
        flash('撤销失败','error')
    return redirect("/zxpgjl/pgjl_info/"+str(id))