python 脚本
mag3.py
1,import
import sys
from org.eclipse.jface.dialogs import MessageDialog
from org.eclipse.core.databinding.validation import ValidationStatus
from com.ifs.btt.cbs.dm import DomainManager
from com.ifs.btt.transport.factory import TransportFactory
from com.ifs.btt.context.global import GlobalContext
from javax.persistence import NoResultException
from java.math import BigDecimal
from java.math import BigInteger
from org.eclipse.swt.layout import GridData
from com.ifs.btt.context.model import AuthItem
from com.ifs.btt.event.manager import EventManager
from com.ifs.btt.event.tran import TranEvent
from java.lang import Math
from java.lang import Long
from com.ifs.btt.message.internal import MessageDataAccessor
from com.ifs.btt.message.xml.convertor import XMLMessageConvertor
from com.ifs.btt.message.xml.impl import XMLMessage
from com.ifs.btt.ui.xwt.scripts import ScriptLoader
from java.util import ArrayList
from java.text import SimpleDateFormat
from jarray import array
from java.lang import String
from com.ifs.btt.ui.xwt.widgets.fields import FComposite
#修改交易菜单检查
def update_tran_menus_init():
context = GlobalContext.getInstance().getTranContext()
tran_code = context.getTranTask().getCode()
load_tran_first_menus_update()
load_tran_second_menus_update()
return True
#加载更新一级菜单
def load_tran_first_menus_update():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"交易菜单维护"
name = group + u".一级菜单"
f=DomainManager.getInstance().getFacadeContext()
widget=screen.getWidget(name)
fcombo=widget.getField()
l=list()
for v in f.nativeFetchMany(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.parent_id is null and class_rollup.child_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' order by classification.id asc ", []):
l.append(str(v[0]) + "#" + v[1])
fcombo.setOptions(",".join(l))
return True
#加载更新二级菜单
def load_tran_second_menus_update():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"交易菜单维护"
name = group + u".二级菜单"
first_class = screen.getValue(group + u".一级菜单")
if first_class is None or first_class =="" :
return False
f=DomainManager.getInstance().getFacadeContext()
widget=screen.getWidget(name)
fcombo=widget.getField()
l=list()
for v in f.nativeFetchMany(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.parent_id = %s and class_rollup.child_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' order by classification.id asc "%(first_class), []):
l.append(str(v[0]) + "#" + v[1])
fcombo.setOptions(",".join(l))
fcombo.setIndex(-1)
return True
#交易码维护检查
def update_check_tran_code():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"原交易信息"
name = group + u".交易代码"
f=DomainManager.getInstance().getFacadeContext()
tran_code = screen.getValue(name)
if tran_code is None or tran_code =="":
if len(tran_code) != 6:
MessageDialog.openError(None, "Error", u"交易代码长度不正确")
return False
tran=f.fetchOne("Tran","Tran","where code=?1",[tran_code])
if tran is None or tran == "":
MessageDialog.openError(None, "Error", u"交易码[%s]不存在" % tran_code)
else:
screen.setValue(group+u".交易名称", tran.getName())
screen.setValue(group+u".交易状态", tran.getTran_status())
screen.setValue(group+u".交易说明", tran.getDescription())
if tran.getControl_level() == "":
screen.setValue(group+u".重点监督级别", u"无")
else :
screen.setValue(group+u".重点监督级别", tran.getControl_level())
if tran.getAuthz_class() == "" :
screen.setValue(group+u".授权类型", u"")
else :
screen.setValue(group+u".授权类型", tran.getAuthz_class())
if tran.getTran_status() == "Y":
screen.setValue(group+u".是否允许反交易", u"是")
else :
screen.setValue(group+u".是否允许反交易", u"否")
tran_task=f.fetchOne("TranTask","TranTask","where code=?1",[tran_code])
if tran_task is None or tran_task == "":
return False
else :
screen.setValue(group+u".服务名称", tran_task.getService())
if tran_task.getTran_task_type_code()=="NORMAL_TASK":
screen.setValue(group+u".交易类型", u"普通交易任务")
elif tran_task.getTran_task_type_code()=="AUTH_TASK":
screen.setValue(group+u".交易类型", u"授权交易任务")
elif tran_task.getTran_task_type_code()=="DELETE_TASK":
screen.setValue(group+u".交易类型", u"删除交易任务")
elif tran_task.getTran_task_type_code()=="INPUT_TASK":
screen.setValue(group+u".交易类型", u"录入交易任务")
elif tran_task.getTran_task_type_code()=="MODIFY_TASK":
screen.setValue(group+u".交易类型", u"修改交易任务")
elif tran_task.getTran_task_type_code()=="PROCESS_TASK":
screen.setValue(group+u".交易类型", u"流程交易任务")
elif tran_task.getTran_task_type_code()=="REVIEW_TASK":
screen.setValue(group+u".交易类型", u"复核交易任务")
screen.setValue(group+u".交易状态", tran.getTran_status())
if tran.getTran_status() == "Y":
screen.setValue(group+u".是否允许反交易", u"是")
else :
screen.setValue(group+u".是否允许反交易", u"否")
#按照交易码取对应允许操作岗位
oper_position = f.nativeFetchOne(" select ac.id,ac.authc_type_code,ac.value from tran t,tran_authc ta ,authc ac where t.id =ta.tran_id and ac.id=ta.authc_id and ac.authc_type_code ='TRAN_OPER_POSITION' and t.id = ?1 ", [tran.getId()])
if oper_position is None:
MessageDialog.openError(None, "Error", u"操作岗位不存在")
return False
screen.getField(group+u".允许操作岗位").setValue(oper_position[2])
#按照交易码取对应的授权模式
authz_class = f.nativeFetchOne(" select atype.code, atype.name from tran t,tran_authz ta ,authz az,authz_type atype where t.id =ta.tran_id and az.id=ta.authz_id and az.authz_type_code=atype.code and atype.code !='REMOTE_REVIEW_AUTH' and t.id= ?1 ",[tran.getId()])
if authz_class is None :
screen.getField(group+u".授权模式", u"不授权")
else:
screen.getField(group+u".授权模式").setValue(authz_class[1])
#从交易码查对应的一级菜单和二级菜单
classification2 = f.fetchOne("classification", "Tran.classification", "where Tran.code = ?1" , [tran_code])
if classification2 is None:
return False
screen.getField(group+u".原归属二级菜单").setValue(classification2.getValue())
classification1 = f.nativeFetchOne(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.child_id = ?1 and class_rollup.parent_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' ", [classification2.getId()])
screen.getField(group+u".原归属一级菜单").setValue(classification1[1])
return True
python 脚本的更多相关文章
- freeswitch嵌入python脚本
操作系统:debian8.5_x64 freeswitch 版本 : 1.6.8 python版本:2.7.9 开启python模块 安装python lib库 apt-get install pyt ...
- python脚本后台运行
问题描述: 环境: CentOS6.4 一个用python写的监控脚本test1.py,用while True方式一直运行,在ssh远程(使用putty终端)时通过以下命令启动脚本: python t ...
- 某互联网后台自动化组合测试框架RF+Sikuli+Python脚本
某互联网后台自动化组合测试框架RF+Sikuli+Python脚本 http://www.jianshu.com/p/b3e204c8651a 字数949 阅读323 评论1 喜欢0 一.**Robo ...
- 动态执行python脚本
前言 存在许多独立的python脚本,这些脚本可能会增加,也可能会减少,现在需要按照某种顺序调度这些程序.在python的standard library中,有一个模块imp可以实现动态的调用ptho ...
- 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本
摘自:http://blog.csdn.net/forandever/article/details/5711319 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本 ...
- SecureCRT中python脚本编写
SecureCRT中python脚本编写学习指南 SecureCRT python 引言 在测试网络设备中,通常使用脚本对设备端进行配置和测试以及维护:对于PE设备的测试维护人员来说使用较多是Secu ...
- Python脚本配合Linux计划任务工作
经常遇到直接运行Python脚本没有问题,但是一放入/etc/crontab之后就歇菜的情况,总结了一下,大致需要注意以下几点: 1. 脚本首行加入#!/usr/bin/env python 2. 脚 ...
- Labview调用Python脚本
Labview程序框图如下: Python脚本如下: #!/usr/bin/env pythonimport sys #Command Line Arguements are stored in li ...
- 使用Runtime.getRuntime().exec()在java中调用python脚本
举例有一个Python脚本叫test.py,现在想要在Java里调用这个脚本.假定这个test.py里面使用了拓展的包,使得pythoninterpreter之类内嵌的编译器无法使用,那么只能采用ja ...
- FTP弱口令猜解【python脚本】
ftp弱口令猜解 python脚本: #! /usr/bin/env python # _*_ coding:utf-8 _*_ import ftplib,time username_list=[' ...
随机推荐
- Mysql数据库导出压缩并保存到指定位置备份脚本
#!/bin/bashbackdir=/home/shaowei/dbbakdbuser='dbusername'dbpass='dbpasswd'dblist=$(ls -p /var/lib/my ...
- git 撤销修改以及删除文件
撤销修改 1.如果当你修改了代码,然后又发现修改错误以后,想撤销前面的操作的时候该怎么办呢? 既然错误发现得很及时,就可以很容易地纠正它.你可以删掉最后一行,手动把文件恢复到上一个版本的状态.如果用 ...
- oracle学习总结3
1:ddl语句创建一张学生表 create table stu(id number(6) not null,name varchar2(20),age number(3),gender char(1) ...
- linux 软件安装各种方法
一 简单介绍 1.软件安装卸载,分几种情况: A:RPM包 这种软件包就像windows的EXE安装文件一样,各种文件已经编译好,并打了包,哪个文件该放到哪个文件夹,都指定好了,安装非常方便,在图 ...
- [转]oracle的ANYDATA数据类型
本文转自:http://blog.csdn.net/yuzhenhuan01/article/details/6606106 ANYDATA数据类型是个有点奇特的类型,你可以把不同数据类型的数据通过转 ...
- OQL对象查询语言
在用mat工具分析内存使用情况查询OutOfMemory原因时,OQL会有很大帮助,所以先在这里总结一下. 基本语法: select <javascript expression to sele ...
- 怎样在CentOS 7.0上安装和配置VNC服务器
VNC轻松连接远程Linux桌面 http://jingyan.baidu.com/article/6c67b1d6f1bac92786bb1e6d.html 这是一个关于怎样在你的 CentOS 7 ...
- Guzzle Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
项目更新到正式平台时,出现Guzzle(5.3) client get请求出现:Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, ...
- 【转】BUG敏感度的培养
在我们刚踏入软件测试行业时,不管你是专业的.非专业的,培训出来的还是未培训的.刚进公司时你看着身边的同时报的Bug很多并且大都是严重程度高,自己也很想提高一下,想要提高自己的bug敏感度,建议从下面几 ...
- winform 上传
public class ImitateSelectFile { public void Select(HtmlElement htmlEle, string fileFullPath) { html ...