Commit 6d498c6d by WeiCong

1.优化日志记录

2.优化数据库未关闭隐患
3.修复getCodeTable方法获取不到码表的缺陷
parent 113b921b
......@@ -116,7 +116,9 @@ public class PreHandle {
}
public static boolean initUserInr(String cid, String oid) {
Session session = HibernateUtils.openSession(null);
Session session = null;
try {
session = HibernateUtils.openSession(null);
String ptySql = "select inr,ptytyp from pty where (ptytyp='2' or PTYTYP='1') and cid=?";
Query<Map> sqlQuery = session.createSQLQuery(ptySql);
sqlQuery.setParameter(1, cid);
......@@ -139,8 +141,13 @@ public class PreHandle {
}
Map usrRs = usrLst.get(0);
USRINR.set((String) usrRs.get("INR"));
session.close();
return true;
} finally {
if (session != null) {
session.close();
}
}
}
public static IModuleRoot getModuleRoot(IContext ctx, String trnName) throws Exception {
......
......@@ -15,6 +15,7 @@ import org.sss.presentation.noui.util.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
public class NoUiContextManager {
......@@ -55,6 +56,7 @@ public class NoUiContextManager {
noUiContext.setGui(new NoUiPresentation(noUiContext, noUiRequest));
noUiContext.setSession(session);
noUiContext.setNoUiRequest(noUiRequest);
noUiContext.setLocale(Locale.getDefault());
log.debug("Build context finished");
return noUiContext;
}
......
......@@ -281,7 +281,7 @@ public abstract class AbstractCommonController {
continue;
}
if (modifyEntry.getKey() == null) {
log.error("错误的modifymap:" + noUiRequest.getMappingUrl() + "--" + modifyMap);
log.error("modifymap中存在键为空的元素:" + noUiRequest.getMappingUrl());
continue;
}
if (aliasPath.startsWith(modifyEntry.getKey())) {
......
......@@ -21,7 +21,7 @@ public class NoUiApiInitListener implements ServletContextListener {
private static final String LOGIN_CONTEXT_NAME = "loginContextName";
private static final String OPEN_PREFIX = "openPrefix";
private static final String OPEN_TRANS = "openTrans";
private static final int ENDLESS_TIME = 5*24*60*60;
private static final int ENDLESS_TIME = 5 * 24 * 60 * 60;
@Override
public void contextDestroyed(ServletContextEvent arg0) {
......@@ -37,15 +37,14 @@ public class NoUiApiInitListener implements ServletContextListener {
NoUiContextManager.dbType = dbType;
NoUiContextManager.loginContextName = context.getInitParameter(LOGIN_CONTEXT_NAME);
String openSource = context.getInitParameter(OPEN_PREFIX);
if(openSource!=null)
if (openSource != null)
NoUiContextManager.openSourcePrefix = openSource;
String trans = context.getInitParameter(OPEN_TRANS);
if(!StringUtils.isEmpty(trans))
{
if (!StringUtils.isEmpty(trans)) {
List<String> openTrans = Arrays.asList(trans.split(","));
NoUiContextManager.openTransactions.addAll( openTrans);
log.debug("开放的交易:"+trans+";"+openTrans);
NoUiContextManager.openTransactions.addAll(openTrans);
log.debug("开放" + openTrans.size() + "个交易:" + trans);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment