Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gechengyang
nouiWithSpringMVC
Commits
6d498c6d
Commit
6d498c6d
authored
Aug 18, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化日志记录
2.优化数据库未关闭隐患 3.修复getCodeTable方法获取不到码表的缺陷
parent
113b921b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
59 deletions
+67
-59
PreHandle.java
src/main/java/org/sss/module/pojo/PreHandle.java
+31
-24
NoUiContextManager.java
...org/sss/presentation/noui/context/NoUiContextManager.java
+2
-0
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+1
-1
NoUiApiInitListener.java
...g/sss/presentation/noui/listener/NoUiApiInitListener.java
+33
-34
No files found.
src/main/java/org/sss/module/pojo/PreHandle.java
View file @
6d498c6d
...
...
@@ -116,31 +116,38 @@ public class PreHandle {
}
public
static
boolean
initUserInr
(
String
cid
,
String
oid
)
{
Session
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
);
sqlQuery
.
setResultTransformer
(
Transformers
.
ALIAS_TO_ENTITY_MAP
);
List
<
Map
>
ptyLst
=
sqlQuery
.
list
();
if
(
ptyLst
==
null
||
ptyLst
.
size
()
==
0
)
{
return
false
;
}
Map
ptyRs
=
ptyLst
.
get
(
0
);
String
ptyinr
=
(
String
)
ptyRs
.
get
(
"INR"
);
String
usrSql
=
"select inr,lgnnam,oprnam from usr where oid=? and ptyinr=?"
;
sqlQuery
=
session
.
createSQLQuery
(
usrSql
);
sqlQuery
.
setParameter
(
1
,
oid
);
sqlQuery
.
setParameter
(
2
,
ptyinr
);
sqlQuery
.
setResultTransformer
(
Transformers
.
ALIAS_TO_ENTITY_MAP
);
List
<
Map
>
usrLst
=
sqlQuery
.
list
();
if
(
usrLst
==
null
||
usrLst
.
size
()
==
0
)
{
return
false
;
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
);
sqlQuery
.
setResultTransformer
(
Transformers
.
ALIAS_TO_ENTITY_MAP
);
List
<
Map
>
ptyLst
=
sqlQuery
.
list
();
if
(
ptyLst
==
null
||
ptyLst
.
size
()
==
0
)
{
return
false
;
}
Map
ptyRs
=
ptyLst
.
get
(
0
);
String
ptyinr
=
(
String
)
ptyRs
.
get
(
"INR"
);
String
usrSql
=
"select inr,lgnnam,oprnam from usr where oid=? and ptyinr=?"
;
sqlQuery
=
session
.
createSQLQuery
(
usrSql
);
sqlQuery
.
setParameter
(
1
,
oid
);
sqlQuery
.
setParameter
(
2
,
ptyinr
);
sqlQuery
.
setResultTransformer
(
Transformers
.
ALIAS_TO_ENTITY_MAP
);
List
<
Map
>
usrLst
=
sqlQuery
.
list
();
if
(
usrLst
==
null
||
usrLst
.
size
()
==
0
)
{
return
false
;
}
Map
usrRs
=
usrLst
.
get
(
0
);
USRINR
.
set
((
String
)
usrRs
.
get
(
"INR"
));
return
true
;
}
finally
{
if
(
session
!=
null
)
{
session
.
close
();
}
}
Map
usrRs
=
usrLst
.
get
(
0
);
USRINR
.
set
((
String
)
usrRs
.
get
(
"INR"
));
session
.
close
();
return
true
;
}
public
static
IModuleRoot
getModuleRoot
(
IContext
ctx
,
String
trnName
)
throws
Exception
{
...
...
src/main/java/org/sss/presentation/noui/context/NoUiContextManager.java
View file @
6d498c6d
...
...
@@ -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
;
}
...
...
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
6d498c6d
...
...
@@ -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
()))
{
...
...
src/main/java/org/sss/presentation/noui/listener/NoUiApiInitListener.java
View file @
6d498c6d
...
...
@@ -14,38 +14,37 @@ import java.util.List;
public
class
NoUiApiInitListener
implements
ServletContextListener
{
protected
static
final
Log
log
=
LogFactory
.
getLog
(
NoUiApiInitListener
.
class
);
private
static
final
String
DATABASE_SUPPORT_TYPE
=
"DbSupportType"
;
private
static
final
String
NOUI_TIMEOUT
=
"nouiTimeout"
;
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
;
@Override
public
void
contextDestroyed
(
ServletContextEvent
arg0
)
{
}
@Override
public
void
contextInitialized
(
ServletContextEvent
contextEvent
)
{
ServletContext
context
=
contextEvent
.
getServletContext
();
String
dbType
=
context
.
getInitParameter
(
DATABASE_SUPPORT_TYPE
);
NoUiContextManager
.
dbType
=
dbType
;
NoUiContextManager
.
loginContextName
=
context
.
getInitParameter
(
LOGIN_CONTEXT_NAME
);
String
openSource
=
context
.
getInitParameter
(
OPEN_PREFIX
);
if
(
openSource
!=
null
)
NoUiContextManager
.
openSourcePrefix
=
openSource
;
String
trans
=
context
.
getInitParameter
(
OPEN_TRANS
);
if
(!
StringUtils
.
isEmpty
(
trans
))
{
List
<
String
>
openTrans
=
Arrays
.
asList
(
trans
.
split
(
","
));
NoUiContextManager
.
openTransactions
.
addAll
(
openTrans
);
log
.
debug
(
"开放的交易:"
+
trans
+
";"
+
openTrans
);
}
}
protected
static
final
Log
log
=
LogFactory
.
getLog
(
NoUiApiInitListener
.
class
);
private
static
final
String
DATABASE_SUPPORT_TYPE
=
"DbSupportType"
;
private
static
final
String
NOUI_TIMEOUT
=
"nouiTimeout"
;
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
;
@Override
public
void
contextDestroyed
(
ServletContextEvent
arg0
)
{
}
@Override
public
void
contextInitialized
(
ServletContextEvent
contextEvent
)
{
ServletContext
context
=
contextEvent
.
getServletContext
();
String
dbType
=
context
.
getInitParameter
(
DATABASE_SUPPORT_TYPE
);
NoUiContextManager
.
dbType
=
dbType
;
NoUiContextManager
.
loginContextName
=
context
.
getInitParameter
(
LOGIN_CONTEXT_NAME
);
String
openSource
=
context
.
getInitParameter
(
OPEN_PREFIX
);
if
(
openSource
!=
null
)
NoUiContextManager
.
openSourcePrefix
=
openSource
;
String
trans
=
context
.
getInitParameter
(
OPEN_TRANS
);
if
(!
StringUtils
.
isEmpty
(
trans
))
{
List
<
String
>
openTrans
=
Arrays
.
asList
(
trans
.
split
(
","
));
NoUiContextManager
.
openTransactions
.
addAll
(
openTrans
);
log
.
debug
(
"开放"
+
openTrans
.
size
()
+
"个交易:"
+
trans
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment