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