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
df85524c
Commit
df85524c
authored
Jul 26, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本继续整合
parent
1860e3a6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
137 additions
and
128 deletions
+137
-128
pom.xml
pom.xml
+1
-1
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+27
-26
NoUiPresentation.java
...a/org/sss/presentation/noui/context/NoUiPresentation.java
+0
-0
TxInfo.java
src/main/java/org/sss/presentation/noui/context/TxInfo.java
+80
-87
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+3
-1
ResourceAccessFilter.java
...rg/sss/presentation/noui/filter/ResourceAccessFilter.java
+6
-2
TokenInterceptor.java
.../java/org/sss/presentation/noui/jwt/TokenInterceptor.java
+5
-0
EhcacheUtils.java
...ain/java/org/sss/presentation/noui/util/EhcacheUtils.java
+1
-1
applicationContext.xml
src/main/resources/applicationContext.xml
+10
-0
hibernate.eibs.xml
src/main/resources/hibernate.eibs.xml
+0
-0
spring-mvc.xml
src/main/resources/spring-mvc.xml
+0
-8
transaction.properties
src/main/resources/transaction.properties
+3
-0
web.xml
src/main/webapp/WEB-INF/web.xml
+1
-2
No files found.
pom.xml
View file @
df85524c
...
...
@@ -3,7 +3,7 @@
<groupId>
cn.com.brilliance
</groupId>
<artifactId>
eibs-springmvc-support
</artifactId>
<packaging>
jar
</packaging>
<version>
1.0.
0
</version>
<version>
1.0.
1
</version>
<name>
eibs-springmvc-support
</name>
<repositories>
<!-- 代码库 -->
<repository>
...
...
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
df85524c
package
org
.
sss
.
presentation
.
noui
.
common
;
public
class
Constants
{
public
final
static
String
PARAMS
=
"params"
;
public
final
static
String
DATA
=
"data"
;
public
final
static
String
DISPLAY
=
"display"
;
public
final
static
String
ENCODING
=
"UTF-8"
;
public
final
static
String
USERNAME
=
"username"
;
public
final
static
String
PASSWORD
=
"password"
;
public
final
static
String
DNCODE
=
"dncode"
;
public
final
static
String
SENDCODE
=
"sendcode"
;
public
final
static
String
VERIFYCODE
=
"verifycode"
;
public
final
static
String
DISPLAY_FILE_NAME
=
"fileName"
;
public
final
static
String
MAPPING_PRE
=
"_"
;
public
final
static
String
SESSION
=
"session"
;
public
final
static
String
BACKGROUND_FLAG
=
"BackGroundRequest-"
;
public
static
final
String
PAGINATION
=
"pagination"
;
public
static
final
String
PAGINATION_INDEX
=
"index"
;
public
static
final
String
PAGINATION_PAGESIZE
=
"pageSize"
;
public
static
final
String
PAGINATION_TOTAL
=
"total"
;
}
package
org
.
sss
.
presentation
.
noui
.
common
;
public
class
Constants
{
public
final
static
String
PARAMS
=
"params"
;
public
final
static
String
DATA
=
"data"
;
public
final
static
String
DISPLAY
=
"display"
;
public
final
static
String
ENCODING
=
"UTF-8"
;
public
final
static
String
USERNAME
=
"username"
;
public
final
static
String
PASSWORD
=
"password"
;
public
final
static
String
DNCODE
=
"dncode"
;
public
final
static
String
SENDCODE
=
"sendcode"
;
public
final
static
String
VERIFYCODE
=
"verifycode"
;
public
final
static
String
DISPLAY_FILE_NAME
=
"fileName"
;
public
final
static
String
MAPPING_PRE
=
"_"
;
public
final
static
String
SESSION
=
"session"
;
public
final
static
String
BACKGROUND_FLAG
=
"BackGroundRequest-"
;
public
final
static
String
APP_FLAG
=
"AppRequest-"
;
public
static
final
String
PAGINATION
=
"pagination"
;
public
static
final
String
PAGINATION_INDEX
=
"index"
;
public
static
final
String
PAGINATION_PAGESIZE
=
"pageSize"
;
public
static
final
String
PAGINATION_TOTAL
=
"total"
;
}
src/main/java/org/sss/presentation/noui/context/NoUiPresentation.java
View file @
df85524c
This diff is collapsed.
Click to expand it.
src/main/java/org/sss/presentation/noui/context/TxInfo.java
View file @
df85524c
package
org
.
sss
.
presentation
.
noui
.
context
;
import
log.Log
;
import
log.LogFactory
;
import
org.apache.commons.io.IOUtils
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
import
org.hibernate.Transaction
;
import
org.hibernate.engine.spi.SessionImplementor
;
import
org.sss.module.hibernate.HibernateUtils
;
import
org.sss.module.pojo.DatabaseUtils
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintStream
;
import
java.util.Date
;
import
java.util.Optional
;
import
java.util.stream.Stream
;
public
class
TxInfo
{
protected
static
final
Log
log
=
LogFactory
.
getLog
(
TxInfo
.
class
);
public
static
ThreadLocal
<
TxInfo
>
txInfoHolder
=
new
ThreadLocal
<>();
public
String
txCode
;
public
String
url
;
public
String
target
;
public
static
void
putTxInfo
(
String
txCode
,
String
url
,
String
target
)
{
TxInfo
txInfo
=
new
TxInfo
();
txInfo
.
txCode
=
txCode
;
txInfo
.
url
=
url
;
txInfo
.
target
=
target
;
txInfoHolder
.
set
(
txInfo
);
}
public
static
TxInfo
getTxInfo
()
{
return
txInfoHolder
.
get
();
}
public
static
void
releaseCurrTxInfo
()
{
txInfoHolder
.
remove
();
}
/**
* 记录异常信息
* @param e
*/
public
static
void
recordException
(
Throwable
e
)
{
TxInfo
txInfo
=
getTxInfo
();
Session
session
=
HibernateUtils
.
openSession
(
null
);
long
count
=
DatabaseUtils
.
executeCounter
(((
SessionImplementor
)
session
).
connection
(),
"dealog"
);
String
inr
=
String
.
format
(
"%08d"
,
count
);
Transaction
transaction
=
session
.
beginTransaction
();
SQLQuery
sqlQuery
=
session
.
createSQLQuery
(
"insert into dealog(INR,CREDATTIM,SRVCOD,SRVNAM,INIFRM,RTNMSG,LOGLEV) values(?,?,?,?,?,?,?)"
);
sqlQuery
.
setString
(
0
,
inr
);
sqlQuery
.
setTimestamp
(
1
,
new
Date
());
String
srvcod
=
txInfo
.
url
.
replace
(
"/_"
,
"-"
);
sqlQuery
.
setString
(
2
,
srvcod
);
sqlQuery
.
setString
(
3
,
srvcod
);
sqlQuery
.
setString
(
4
,
txInfo
.
txCode
);
sqlQuery
.
setString
(
5
,
genMessage
(
e
));
sqlQuery
.
setString
(
6
,
"error"
);
sqlQuery
.
executeUpdate
();
transaction
.
commit
();
session
.
close
();
log
.
debug
(
"完成异常日志记录"
);
}
private
static
String
genMessage
(
Throwable
e
)
{
while
(
e
.
getCause
()
!=
null
)
e
=
e
.
getCause
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
PrintStream
ps
=
new
PrintStream
(
bos
);
e
.
printStackTrace
(
ps
);
String
mesg
=
bos
.
toString
();
IOUtils
.
closeQuietly
(
ps
);
IOUtils
.
closeQuietly
(
bos
);
String
[]
lines
=
mesg
.
split
(
"[\r\n]{1,2}"
);
Optional
<
String
>
rs
=
Stream
.
of
(
lines
).
filter
(
str
->{
return
str
.
charAt
(
0
)
!=
'\t'
||
(
str
.
indexOf
(
"brilliance"
)>
0
||
str
.
indexOf
(
".noui."
)>
0
);
}).
reduce
((
acc
,
item
)->{
return
acc
+
'\n'
+
item
;
});
return
rs
.
get
();
}
}
package
org
.
sss
.
presentation
.
noui
.
context
;
import
log.Log
;
import
log.LogFactory
;
import
org.apache.commons.io.IOUtils
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintStream
;
import
java.util.Optional
;
import
java.util.stream.Stream
;
public
class
TxInfo
{
protected
static
final
Log
log
=
LogFactory
.
getLog
(
TxInfo
.
class
);
public
static
ThreadLocal
<
TxInfo
>
txInfoHolder
=
new
ThreadLocal
<>();
public
String
txCode
;
public
String
url
;
public
String
target
;
public
static
void
putTxInfo
(
String
txCode
,
String
url
,
String
target
)
{
TxInfo
txInfo
=
new
TxInfo
();
txInfo
.
txCode
=
txCode
;
txInfo
.
url
=
url
;
txInfo
.
target
=
target
;
txInfoHolder
.
set
(
txInfo
);
}
public
static
TxInfo
getTxInfo
()
{
return
txInfoHolder
.
get
();
}
public
static
void
releaseCurrTxInfo
()
{
txInfoHolder
.
remove
();
}
/**
* 记录异常信息
* @param e
*/
public
static
void
recordException
(
Throwable
e
)
{
/*TxInfo txInfo = getTxInfo();
Session session = HibernateUtils.openSession(null);
long count = DatabaseUtils.executeCounter(((SessionImplementor) session).connection(),"dealog");
String inr = String.format("%08d",count);
Transaction transaction = session.beginTransaction();
SQLQuery sqlQuery = session.createSQLQuery("insert into dealog(INR,CREDATTIM,SRVCOD,SRVNAM,INIFRM,RTNMSG,LOGLEV) values(?,?,?,?,?,?,?)");
sqlQuery.setString(0,inr);
sqlQuery.setTimestamp(1,new Date());
String srvcod = txInfo.url.replace("/_","-");
sqlQuery.setString(2,srvcod);
sqlQuery.setString(3,srvcod);
sqlQuery.setString(4,txInfo.txCode);
sqlQuery.setString(5,genMessage(e));
sqlQuery.setString(6,"error");
sqlQuery.executeUpdate();
transaction.commit();
session.close();
log.debug("完成异常日志记录");*/
}
private
static
String
genMessage
(
Throwable
e
)
{
while
(
e
.
getCause
()
!=
null
)
e
=
e
.
getCause
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
PrintStream
ps
=
new
PrintStream
(
bos
);
e
.
printStackTrace
(
ps
);
String
mesg
=
bos
.
toString
();
IOUtils
.
closeQuietly
(
ps
);
IOUtils
.
closeQuietly
(
bos
);
String
[]
lines
=
mesg
.
split
(
"[\r\n]{1,2}"
);
Optional
<
String
>
rs
=
Stream
.
of
(
lines
).
filter
(
str
->{
return
str
.
charAt
(
0
)
!=
'\t'
||
(
str
.
indexOf
(
"brilliance"
)>
0
||
str
.
indexOf
(
".noui."
)>
0
);
}).
reduce
((
acc
,
item
)->{
return
acc
+
'\n'
+
item
;
});
return
rs
.
get
();
}
}
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
df85524c
...
...
@@ -72,8 +72,10 @@ public abstract class AbstractCommonController {
}
// 设置old sysmod
RedisLoginInfo
redisLoginInfo
=
null
;
if
(!
StringUtils
.
isEmpty
(
noUiRequest
.
getUserId
()))
//开放模式下
if
(!
StringUtils
.
isEmpty
(
noUiRequest
.
getUserId
())){
//开放模式下
redisLoginInfo
=
(
RedisLoginInfo
)
EhcacheUtils
.
get
(
StringUtil
.
userUniqueId
(
noUiRequest
));
}
if
(
redisLoginInfo
!=
null
)
{
NoUiPresentationUtil
.
setSysmod
(
context
,
(
byte
[])
redisLoginInfo
.
getSysmod
());
context
.
setRedisLoginInfo
(
redisLoginInfo
);
...
...
src/main/java/org/sss/presentation/noui/filter/ResourceAccessFilter.java
View file @
df85524c
...
...
@@ -25,6 +25,7 @@ public class ResourceAccessFilter implements Filter {
private
static
final
String
_403_JSON
=
"{\"code\": \"403\", \"msg\": \"Access Forbidden, Unauthorized!\"}"
;
private
static
final
String
_403_HTML
=
"<html><body><div style='text-align:center'><h1 style='margin-top: 10px;'>Access Forbidden, Unauthorized!</h1></div></body></html>"
;
private
static
final
String
DSPPTH
=
"/data/dsp/"
;
private
static
final
String
[]
empty_array
=
new
String
[
0
];
public
static
String
[]
pdfpth
;
public
static
String
[]
exclude
;
...
...
@@ -113,7 +114,6 @@ public class ResourceAccessFilter implements Filter {
}
private
String
needPdfsFilter
(
String
uri
)
{
for
(
String
pdf
:
pdfpth
)
{
if
(
uri
.
contains
(
pdf
))
{
...
...
@@ -175,11 +175,15 @@ public class ResourceAccessFilter implements Filter {
}
public
void
init
(
FilterConfig
filterConfig
)
{
if
(
filterConfig
.
getInitParameter
(
"pdfpth"
)
!=
null
)
{
if
(
!
StringUtil
.
isEmpty
(
filterConfig
.
getInitParameter
(
"pdfpth"
))
)
{
pdfpth
=
filterConfig
.
getInitParameter
(
"pdfpth"
).
split
(
";"
);
}
else
{
pdfpth
=
empty_array
;
}
if
(!
StringUtil
.
isEmpty
(
filterConfig
.
getInitParameter
(
"exclude"
)))
{
exclude
=
filterConfig
.
getInitParameter
(
"exclude"
).
split
(
";"
);
}
else
{
exclude
=
empty_array
;
}
}
...
...
src/main/java/org/sss/presentation/noui/jwt/TokenInterceptor.java
View file @
df85524c
...
...
@@ -51,6 +51,11 @@ public class TokenInterceptor implements HandlerInterceptor {
if
(
token
.
startsWith
(
Constants
.
BACKGROUND_FLAG
))
{
return
true
;
}
//服务调用
if
(
token
.
startsWith
(
Constants
.
APP_FLAG
))
{
return
true
;
}
JwtLogin
login
=
JWT
.
unsign
(
token
,
JwtLogin
.
class
);
if
(
login
==
null
||
(!
userId
.
equals
((
login
.
getUserId
()))))
{
...
...
src/main/java/org/sss/presentation/noui/util/EhcacheUtils.java
View file @
df85524c
...
...
@@ -44,7 +44,7 @@ public class EhcacheUtils {
EhCacheCacheManager
ehCacheCacheManager
=
null
;
try
{
if
(
cacheManager
==
null
)
{
ehCacheCacheManager
=
SpringContextHolder
.
getBean
(
EhCacheCacheManager
.
class
);
ehCacheCacheManager
=
SpringContextHolder
.
getBean
(
"ehcacheManager"
);
cacheManager
=
ehCacheCacheManager
.
getCacheManager
();
}
}
catch
(
Exception
e
)
{
...
...
src/main/resources/applicationContext.xml
View file @
df85524c
...
...
@@ -14,6 +14,15 @@
</property>
</bean>
<!--cacheManager工厂类,指定ehcache.xml的位置-->
<bean
id=
"ehcacheManagerFactory"
class=
"org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
>
<property
name=
"configLocation"
value=
"classpath:ehcache.xml"
/>
</bean>
<!--声明cacheManager-->
<bean
id=
"ehcacheManager"
class=
"org.springframework.cache.ehcache.EhCacheCacheManager"
>
<property
name=
"cacheManager"
ref=
"ehcacheManagerFactory"
/>
</bean>
<bean
id=
"springContextHolder"
class=
"org.sss.presentation.noui.util.SpringContextHolder"
/>
</beans>
\ No newline at end of file
src/main/resources/hibernate.eibs.xml
View file @
df85524c
This diff is collapsed.
Click to expand it.
src/main/resources/spring-mvc.xml
View file @
df85524c
...
...
@@ -39,15 +39,7 @@
<property
name=
"rootFilePath"
value=
""
/>
</bean>
<!--cacheManager工厂类,指定ehcache.xml的位置-->
<bean
id=
"ehcacheManagerFactory"
class=
"org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
>
<property
name=
"configLocation"
value=
"classpath:ehcache.xml"
/>
</bean>
<!--声明cacheManager-->
<bean
id=
"ehcacheManager"
class=
"org.springframework.cache.ehcache.EhCacheCacheManager"
>
<property
name=
"cacheManager"
ref=
"ehcacheManagerFactory"
/>
</bean>
<mvc:default-servlet-handler
/>
<mvc:interceptors>
...
...
src/main/resources/transaction.properties
0 → 100644
View file @
df85524c
package.base
=
com.brilliance.eibs.etrade
subpackage.trans
=
trans
subpackage.module
=
module
src/main/webapp/WEB-INF/web.xml
View file @
df85524c
...
...
@@ -82,8 +82,7 @@
</init-param>
<init-param>
<param-name>
exclude
</param-name>
<param-value>
</param-value>
<param-value></param-value>
</init-param>
</filter>
<filter-mapping>
...
...
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