Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
foc_manage
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
首航-临时账号
foc_manage
Commits
a06ded9e
Commit
a06ded9e
authored
Sep 07, 2020
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码规范
parent
89564d2b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
259 additions
and
728 deletions
+259
-728
SecurityPropertyPlaceholderConfigurer.java
src/com/ejweb/core/conf/SecurityPropertyPlaceholderConfigurer.java
+6
-89
LogInterceptor.java
src/com/ejweb/core/filter/LogInterceptor.java
+28
-28
Page.java
src/com/ejweb/core/persistence/Page.java
+0
-0
PaginationInterceptor.java
src/com/ejweb/core/persistence/interceptor/PaginationInterceptor.java
+0
-10
ValidateCodeServlet.java
src/com/ejweb/core/servlet/ValidateCodeServlet.java
+6
-6
MacUtils.java
src/com/ejweb/core/utils/MacUtils.java
+10
-12
MobileSendMessage.java
src/com/ejweb/core/utils/MobileSendMessage.java
+0
-113
PropertiesLoader.java
src/com/ejweb/core/utils/PropertiesLoader.java
+6
-11
QRCodeUtil.java
src/com/ejweb/core/utils/QRCodeUtil.java
+50
-117
SendMailUtil.java
src/com/ejweb/core/utils/SendMailUtil.java
+0
-0
SpringContextHolder.java
src/com/ejweb/core/utils/SpringContextHolder.java
+0
-15
UploadUtils.java
src/com/ejweb/core/utils/UploadUtils.java
+6
-13
WorkDayUtils.java
src/com/ejweb/core/utils/WorkDayUtils.java
+0
-4
VerifyEntity.java
src/com/ejweb/modules/airline/entity/VerifyEntity.java
+0
-1
SailingFileService.java
src/com/ejweb/modules/airline/service/SailingFileService.java
+29
-27
VerifyAddService.java
src/com/ejweb/modules/airline/service/VerifyAddService.java
+0
-4
VerifyUpdateUserService.java
src/com/ejweb/modules/airline/service/VerifyUpdateUserService.java
+3
-20
VerifyAddController.java
src/com/ejweb/modules/airline/web/VerifyAddController.java
+0
-11
SeatEntity.java
src/com/ejweb/modules/contact/entity/SeatEntity.java
+0
-9
UserProfileEntity.java
src/com/ejweb/modules/contact/entity/UserProfileEntity.java
+6
-42
SeatService.java
src/com/ejweb/modules/contact/service/SeatService.java
+11
-8
Seat2Controller.java
src/com/ejweb/modules/contact/web/Seat2Controller.java
+0
-2
SoundRecordingController.java
src/com/ejweb/modules/contact/web/SoundRecordingController.java
+0
-1
NotifyController.java
src/com/ejweb/modules/notify/web/NotifyController.java
+18
-29
StartnoController.java
src/com/ejweb/modules/startno/web/StartnoController.java
+0
-4
Role.java
src/com/ejweb/modules/sys/entity/Role.java
+0
-22
SystemAuthorizingRealm.java
src/com/ejweb/modules/sys/security/SystemAuthorizingRealm.java
+0
-13
UserUtils.java
src/com/ejweb/modules/sys/utils/UserUtils.java
+1
-17
OfficeController.java
src/com/ejweb/modules/sys/web/OfficeController.java
+51
-60
UserController.java
src/com/ejweb/modules/sys/web/UserController.java
+0
-1
MybatisRunnable.java
src/org/apache/ibatis/thread/MybatisRunnable.java
+28
-39
No files found.
src/com/ejweb/core/conf/SecurityPropertyPlaceholderConfigurer.java
View file @
a06ded9e
...
...
@@ -26,7 +26,6 @@ import com.ejweb.core.security.DES3Utils;
* @time 2016年11月2日
*/
public
class
SecurityPropertyPlaceholderConfigurer
extends
PropertyPlaceholderConfigurer
{
// private static final String key = "";
private
static
final
String
CONF_DESC_KEY
=
"782790337169117184"
;
private
Map
<
String
,
Boolean
>
keys
=
new
HashMap
<
String
,
Boolean
>();
...
...
@@ -34,20 +33,19 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
@Override
protected
void
processProperties
(
ConfigurableListableBeanFactory
beanFactory
,
Properties
props
)
throws
BeansException
{
// TODO Auto-generated method stub
try
{
if
(
getBoolean
(
props
,
"is.devmode"
,
false
)
==
false
){
// 非开发环境需要对配置文件加密
// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
Enumeration
<?>
enu
=
props
.
propertyNames
();
// 非开发环境需要对配置文件加密
if
(
getBoolean
(
props
,
"is.devmode"
,
false
)
==
false
)
{
Enumeration
<?>
enu
=
props
.
propertyNames
();
while
(
enu
.
hasMoreElements
())
{
try
{
String
key
=
(
String
)
enu
.
nextElement
();
if
(
"is.devmode"
.
equals
(
key
)
==
false
&&
keys
.
get
(
key
)
==
null
)
{
// 还未处理
if
(
"is.devmode"
.
equals
(
key
)
==
false
&&
keys
.
get
(
key
)
==
null
)
{
// 还未处理
keys
.
put
(
key
,
true
);
String
val
=
(
String
)
props
.
get
(
key
);
String
decrypted
=
DES3Utils
.
decrypt
(
val
,
CONF_DESC_KEY
);
if
(
decrypted
!=
null
)
{
if
(
decrypted
!=
null
)
{
props
.
put
(
key
,
decrypted
);
}
...
...
@@ -75,85 +73,4 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
}
return
want
;
}
/**
* 解密
* @param encode
* @return
*/
// public static String decrypt(String encode) {
// if (StringUtils.isBlank(encode)) {
// return null;
// }
// try {
// DESPlus des = new DESPlus(CONF_DESC_KEY);
// return des.decrypt(encode);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// System.out.println(DES3Utils.encrypt("http://127.0.0.1:8080/", CONF_DESC_KEY));
// System.out.println(DES3Utils.decrypt("31a63fac8317458d81c034906825749f7c58c30a773c6927", CONF_DESC_KEY));
// InputStream in = new FileInputStream(new File("W:\\FOC智能管控系统\\线上配置\\20161221\\manage.conf\\3DES加密版本\\ejweb.properties"));
// InputStream in = new FileInputStream(new File("W:\\FOC智能管控系统\\线上配置\\20161221\\manage.conf\\ejweb.properties"));
// InputStream in = new FileInputStream(new File("W:\\FOC智能管控系统\\线上配置\\all_conf.20170423\\all_conf\\manage_conf\\ejweb.properties"));
// Properties props = new Properties();
// props.load(in);
// DES解密版本
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
//
// System.out.println("正常: "+key+"="+des.decrypt(val));
//
//// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// 3DES加密
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
//
// System.out.println("正常: "+key+"="+val+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
// String decrypted = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decrypted == null){
// System.out.println("新增: "+key+"="+val);
// } else{
// System.out.println("NULL新增: "+key+"="+decrypted);
// }
//// System.out.println("正常: "+key+"="+DES3Utils.decrypt(val, CONF_DESC_KEY));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// System.out.println(DES3Utils.encrypt("jdbc:mysql://10.70.78.27:3306/foc?useUnicode=true&characterEncoding=utf-8", CONF_DESC_KEY));
System
.
out
.
println
(
DES3Utils
.
decrypt
(
"31a63fac8317458d81c034906825749f7c58c30a773c6927"
,
CONF_DESC_KEY
));
}
}
src/com/ejweb/core/filter/LogInterceptor.java
View file @
a06ded9e
...
...
@@ -3,20 +3,19 @@
*/
package
com
.
ejweb
.
core
.
filter
;
import
java.text.SimpleDateFormat
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ejweb.core.service.BaseService
;
import
com.ejweb.core.utils.DateUtils
;
import
org.springframework.core.NamedThreadLocal
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ejweb.core.service.BaseService
;
import
com.ejweb.core.utils.DateUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.SimpleDateFormat
;
/**
* 日志拦截器
*
* @author ThinkGem
* @version 2014-8-19
*/
...
...
@@ -24,44 +23,45 @@ public class LogInterceptor extends BaseService implements HandlerInterceptor {
private
static
final
ThreadLocal
<
Long
>
startTimeThreadLocal
=
new
NamedThreadLocal
<
Long
>(
"ThreadLocal StartTime"
);
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
if
(
logger
.
isDebugEnabled
()){
long
beginTime
=
System
.
currentTimeMillis
();
//1、开始时间
startTimeThreadLocal
.
set
(
beginTime
);
//线程绑定变量(该数据只有当前请求的线程可见)
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
if
(
logger
.
isDebugEnabled
())
{
//1、开始时间
long
beginTime
=
System
.
currentTimeMillis
();
//线程绑定变量(该数据只有当前请求的线程可见)
startTimeThreadLocal
.
set
(
beginTime
);
logger
.
debug
(
"开始计时: {} URI: {}"
,
new
SimpleDateFormat
(
"hh:mm:ss.SSS"
)
.
format
(
beginTime
),
request
.
getRequestURI
());
.
format
(
beginTime
),
request
.
getRequestURI
());
}
return
true
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
if
(
modelAndView
!=
null
){
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
if
(
modelAndView
!=
null
)
{
logger
.
info
(
"ViewName: "
+
modelAndView
.
getViewName
());
}
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
// // 保存日志
// LogUtils.saveLog(request, handler, ex, null);
// 打印JVM信息。
if
(
logger
.
isDebugEnabled
()){
long
beginTime
=
startTimeThreadLocal
.
get
();
//得到线程绑定的局部变量(开始时间)
long
endTime
=
System
.
currentTimeMillis
();
//2、结束时间
if
(
logger
.
isDebugEnabled
())
{
//得到线程绑定的局部变量(开始时间)
long
beginTime
=
startTimeThreadLocal
.
get
();
//2、结束时间
long
endTime
=
System
.
currentTimeMillis
();
logger
.
debug
(
"计时结束:{} 耗时:{} URI: {} 最大内存: {}m 已分配内存: {}m 已分配内存中的剩余空间: {}m 最大可用内存: {}m"
,
new
SimpleDateFormat
(
"hh:mm:ss.SSS"
).
format
(
endTime
),
DateUtils
.
formatDateTime
(
endTime
-
beginTime
),
request
.
getRequestURI
(),
Runtime
.
getRuntime
().
maxMemory
()
/
1024
/
1024
,
Runtime
.
getRuntime
().
totalMemory
()/
1024
/
1024
,
Runtime
.
getRuntime
().
freeMemory
()/
1024
/
1024
,
(
Runtime
.
getRuntime
().
maxMemory
()
-
Runtime
.
getRuntime
().
totalMemory
()+
Runtime
.
getRuntime
().
freeMemory
())/
1024
/
1024
);
request
.
getRequestURI
(),
Runtime
.
getRuntime
().
maxMemory
()
/
1024
/
1024
,
Runtime
.
getRuntime
().
totalMemory
()
/
1024
/
1024
,
Runtime
.
getRuntime
().
freeMemory
()
/
1024
/
1024
,
(
Runtime
.
getRuntime
().
maxMemory
()
-
Runtime
.
getRuntime
().
totalMemory
()
+
Runtime
.
getRuntime
().
freeMemory
())
/
1024
/
1024
);
}
}
}
src/com/ejweb/core/persistence/Page.java
View file @
a06ded9e
This diff is collapsed.
Click to expand it.
src/com/ejweb/core/persistence/interceptor/PaginationInterceptor.java
View file @
a06ded9e
...
...
@@ -23,8 +23,6 @@ import java.util.Properties;
/**
* 数据库分页插件,只拦截查询语句.
* @author poplar.yfyang / thinkgem
* @version 2013-8-28
*/
@Intercepts
({
@Signature
(
type
=
Executor
.
class
,
method
=
"query"
,
args
=
{
MappedStatement
.
class
,
Object
.
class
,
RowBounds
.
class
,
ResultHandler
.
class
})})
...
...
@@ -36,10 +34,6 @@ public class PaginationInterceptor extends BaseInterceptor {
public
Object
intercept
(
Invocation
invocation
)
throws
Throwable
{
final
MappedStatement
mappedStatement
=
(
MappedStatement
)
invocation
.
getArgs
()[
0
];
// //拦截需要分页的SQL
//// if (mappedStatement.getId().matches(_SQL_PATTERN)) {
// if (StringUtils.indexOfIgnoreCase(mappedStatement.getId(), _SQL_PATTERN) != -1) {
Object
parameter
=
invocation
.
getArgs
()[
1
];
BoundSql
boundSql
=
mappedStatement
.
getBoundSql
(
parameter
);
Object
parameterObject
=
boundSql
.
getParameterObject
();
...
...
@@ -63,9 +57,6 @@ public class PaginationInterceptor extends BaseInterceptor {
//分页查询 本地化对象 修改数据库注意修改实现
String
pageSql
=
SQLHelper
.
generatePageSql
(
originalSql
,
page
,
DIALECT
);
// if (log.isDebugEnabled()) {
// log.debug("PAGE SQL:" + StringUtils.replace(pageSql, "\n", ""));
// }
invocation
.
getArgs
()[
2
]
=
new
RowBounds
(
RowBounds
.
NO_ROW_OFFSET
,
RowBounds
.
NO_ROW_LIMIT
);
BoundSql
newBoundSql
=
new
BoundSql
(
mappedStatement
.
getConfiguration
(),
pageSql
,
boundSql
.
getParameterMappings
(),
boundSql
.
getParameterObject
());
//解决MyBatis 分页foreach 参数失效 start
...
...
@@ -78,7 +69,6 @@ public class PaginationInterceptor extends BaseInterceptor {
invocation
.
getArgs
()[
0
]
=
newMs
;
}
// }
return
invocation
.
proceed
();
}
...
...
src/com/ejweb/core/servlet/ValidateCodeServlet.java
View file @
a06ded9e
...
...
@@ -48,10 +48,11 @@ public class ValidateCodeServlet extends HttpServlet {
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
validateCode
=
request
.
getParameter
(
VALIDATE_CODE
);
// AJAX验证,成功返回true
if
(
StringUtils
.
isNotBlank
(
validateCode
)){
response
.
getOutputStream
().
print
(
validate
(
request
,
validateCode
)?
"true"
:
"false"
);
}
else
{
// AJAX验证,成功返回true
String
validateCode
=
request
.
getParameter
(
VALIDATE_CODE
);
if
(
StringUtils
.
isNotBlank
(
validateCode
))
{
response
.
getOutputStream
().
print
(
validate
(
request
,
validateCode
)
?
"true"
:
"false"
);
}
else
{
this
.
doPost
(
request
,
response
);
}
}
...
...
@@ -137,11 +138,10 @@ public class ValidateCodeServlet extends HttpServlet {
Random
random
=
new
Random
();
StringBuilder
s
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
String
r
=
String
.
valueOf
(
codeSeq
[
random
.
nextInt
(
codeSeq
.
length
)]);
//random.nextInt(10));
String
r
=
String
.
valueOf
(
codeSeq
[
random
.
nextInt
(
codeSeq
.
length
)]);
g
.
setColor
(
new
Color
(
50
+
random
.
nextInt
(
100
),
50
+
random
.
nextInt
(
100
),
50
+
random
.
nextInt
(
100
)));
g
.
setFont
(
new
Font
(
fontTypes
[
random
.
nextInt
(
fontTypes
.
length
)],
Font
.
BOLD
,
26
));
g
.
drawString
(
r
,
15
*
i
+
5
,
19
+
random
.
nextInt
(
8
));
// g.drawString(r, i*w/4, h-5);
s
.
append
(
r
);
}
return
s
.
toString
();
...
...
src/com/ejweb/core/utils/MacUtils.java
View file @
a06ded9e
...
...
@@ -9,7 +9,7 @@ import java.io.InputStreamReader;
/**
* MAC地址工具
*
*
* @author ThinkGem
* @version 2013-12-21
*/
...
...
@@ -24,7 +24,7 @@ public class MacUtils {
/**
* 获取Unix网卡的mac地址.
*
*
* @return mac地址
*/
public
static
String
getUnixMACAddress
()
{
...
...
@@ -75,7 +75,7 @@ public class MacUtils {
/**
* 获取Linux网卡的mac地址.
*
*
* @return mac地址
*/
public
static
String
getLinuxMACAddress
()
{
...
...
@@ -117,9 +117,9 @@ public class MacUtils {
bufferedReader
=
null
;
process
=
null
;
}
// 取不到,试下Unix取发
if
(
mac
==
null
){
if
(
mac
==
null
)
{
return
getUnixMACAddress
();
}
...
...
@@ -128,7 +128,7 @@ public class MacUtils {
/**
* 获取widnows网卡的mac地址.
*
*
* @return mac地址
*/
public
static
String
getWindowsMACAddress
()
{
...
...
@@ -147,9 +147,7 @@ public class MacUtils {
/**
* 寻找标示字符串[physical address]
*/
// index = line.toLowerCase().indexOf("physical address");
// if (index != -1) {
if
(
line
.
split
(
"-"
).
length
==
6
){
if
(
line
.
split
(
"-"
).
length
==
6
)
{
index
=
line
.
indexOf
(
":"
);
if
(
index
!=
-
1
)
{
/**
...
...
@@ -188,7 +186,7 @@ public class MacUtils {
return
mac
;
}
public
static
String
getMac
(){
public
static
String
getMac
()
{
String
os
=
getOSName
();
String
mac
;
if
(
os
.
startsWith
(
"windows"
))
{
...
...
@@ -200,10 +198,10 @@ public class MacUtils {
}
return
mac
==
null
?
""
:
mac
;
}
/**
* 测试用的main方法.
*
*
* @param argc 运行参数.
*/
public
static
void
main
(
String
[]
argc
)
{
...
...
src/com/ejweb/core/utils/MobileSendMessage.java
deleted
100644 → 0
View file @
89564d2b
package
com
.
ejweb
.
core
.
utils
;
//import java.util.List;
//
//import com.baidu.yun.channel.auth.ChannelKeyPair;
//import com.baidu.yun.channel.client.BaiduChannelClient;
//import com.baidu.yun.channel.exception.ChannelClientException;
//import com.baidu.yun.channel.exception.ChannelServerException;
//import com.baidu.yun.channel.model.PushBroadcastMessageRequest;
//import com.baidu.yun.channel.model.PushUnicastMessageRequest;
//import com.baidu.yun.core.log.YunLogEvent;
//import com.baidu.yun.core.log.YunLogHandler;
//import com.ejweb.modules.sys.entity.User;
//import com.ejweb.modules.sys.utils.UserUtils;
public
class
MobileSendMessage
{
public
static
final
String
apiKey
=
"oc0yx4ST3dNQcGbXNQUNE2yn"
;
public
static
final
String
secretKey
=
"KpRboB9HiE6wm7I9IHtcMLnNGZY0S27W"
;
// /**
// * 无限制推送广播
// * @param title
// * @param content
// */
// public static void pushBroadcastMessage(String title,String content) {
//
// ChannelKeyPair pair = new ChannelKeyPair(MobileSendMessage.apiKey, MobileSendMessage.secretKey);
//
// // 2. 创建BaiduChannelClient对象实例
// BaiduChannelClient channelClient = new BaiduChannelClient(pair);
//
// // 3. 若要了解交互细节,请注册YunLogHandler类
// channelClient.setChannelLogHandler(new YunLogHandler() {
// @Override
// public void onHandle(YunLogEvent event) {
// System.out.println(event.getMessage());
// }
// });
// // 4. 创建请求类对象
// PushBroadcastMessageRequest request = new PushBroadcastMessageRequest();
// request.setDeviceType(3); // device_type => 1: web 2: pc 3:android // 4:ios 5:wp
//
// // request.setMessage("Hello Channel");
// // 若要通知,
// request.setMessageType(1);
// request.setMessage("{\"title\":\""+title+"\",\"description\":\""+content+"\"}");
// //request.setMessage(notify.toString());
//
// // 5. 调用pushMessage接口
// try {
// channelClient.pushBroadcastMessage(request);
// // 6. 认证推送成功
//// System.out.println("push amount : " + response.getSuccessAmount());
// } catch (ChannelClientException e) {
// e.printStackTrace();
// } catch (ChannelServerException e) {
// e.printStackTrace();
// }
//
// }
//
//
// /**
// * 多人员手机提醒信息发送
// * @param title
// * @param content
// * @param users
// */
// public static void pushUnicastMessageMessage(String title,String content,List<String> userIds) {
//
// ChannelKeyPair pair = new ChannelKeyPair(MobileSendMessage.apiKey, MobileSendMessage.secretKey);
//
// // 2. 创建BaiduChannelClient对象实例
// BaiduChannelClient channelClient = new BaiduChannelClient(pair);
//
// // 3. 若要了解交互细节,请注册YunLogHandler类
// channelClient.setChannelLogHandler(new YunLogHandler() {
// @Override
// public void onHandle(YunLogEvent event) {
// System.out.println(event.getMessage());
// }
// });
// // 4. 创建请求类对象
// PushUnicastMessageRequest request = new PushUnicastMessageRequest();
// request.setDeviceType(3); // device_type => 1: web 2: pc 3:android // 4:ios 5:wp
//
// // request.setMessage("Hello Channel");
// // 若要通知,
// request.setMessageType(1);
// request.setMessage("{\"title\":\""+title+"\",\"description\":\""+content+"\"}");
//
// // 5. 调用pushMessage接口
// try {
// for (String userId : userIds) {
// User sendUser=UserUtils.get(userId);
// if(sendUser!=null){
// request.setChannelId(Long.valueOf(sendUser.getMobileChannelId()));
// request.setUserId(sendUser.getMobileUserId());
// channelClient.pushUnicastMessage(request);
// }
// }
//
// // 6. 认证推送成功
//// System.out.println("push amount : " + response.getSuccessAmount());
// } catch (ChannelClientException e) {
// e.printStackTrace();
// } catch (ChannelServerException e) {
// e.printStackTrace();
// }
//
// }
}
src/com/ejweb/core/utils/PropertiesLoader.java
View file @
a06ded9e
/**
* Copyright (c) 2005-2011 springside.org.cn
*
*
<p>
* $Id: PropertiesLoader.java 1690 2012-02-22 13:42:00Z calvinxiu $
*/
package
com
.
ejweb
.
core
.
utils
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.NoSuchElementException
;
import
java.util.Properties
;
import
org.apache.commons.io.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -17,10 +12,13 @@ import org.springframework.core.io.DefaultResourceLoader;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.NoSuchElementException
;
import
java.util.Properties
;
/**
* Properties文件载入工具类. 可载入多个properties文件, 相同的属性在最后载入的文件中的值将会覆盖之前的值,但以System的Property优先.
* @author calvin
* @version 2013-05-15
*/
public
class
PropertiesLoader
{
...
...
@@ -135,9 +133,6 @@ public class PropertiesLoader {
Properties
props
=
new
Properties
();
for
(
String
location
:
resourcesPaths
)
{
// logger.debug("Loading properties file from:" + location);
InputStream
is
=
null
;
try
{
Resource
resource
=
resourceLoader
.
getResource
(
location
);
...
...
src/com/ejweb/core/utils/QRCodeUtil.java
View file @
a06ded9e
package
com
.
ejweb
.
core
.
utils
;
import
java.awt.BasicStroke
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Image
;
import
java.awt.Shape
;
import
com.google.zxing.*
;
import
com.google.zxing.client.j2se.BufferedImageLuminanceSource
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.common.HybridBinarizer
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.geom.RoundRectangle2D
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.OutputStream
;
import
java.util.Hashtable
;
import
javax.imageio.ImageIO
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.BinaryBitmap
;
import
com.google.zxing.DecodeHintType
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatReader
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.Result
;
import
com.google.zxing.client.j2se.BufferedImageLuminanceSource
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.common.HybridBinarizer
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
/**
* 二维码工具类
*
* Java二维码工具类,中间带LOGO的,很强大
*
* 博文地址: http://blog.csdn.net/mmm333zzz/article/details/17259513
*
* 下载地址: http://download.csdn.net/detail/mmm333zzz/6695793
*
*/
public
class
QRCodeUtil
{
private
static
final
String
CHARSET
=
"UTF-8"
;
private
static
final
String
FORMAT_NAME
=
"JPG"
;
// 二维码尺寸
private
static
final
int
QRCODE_SIZE
=
300
;
// LOGO宽度
private
static
final
int
WIDTH
=
60
;
// LOGO高度
private
static
final
int
HEIGHT
=
60
;
private
static
BufferedImage
createImage
(
String
content
,
String
imgPath
,
boolean
needCompress
)
throws
Exception
{
boolean
needCompress
)
throws
Exception
{
Hashtable
<
EncodeHintType
,
Object
>
hints
=
new
Hashtable
<
EncodeHintType
,
Object
>();
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
CHARSET
);
...
...
@@ -74,20 +53,17 @@ public class QRCodeUtil {
/**
* 插入LOGO
*
* @param source
* 二维码图片
* @param imgPath
* LOGO图片地址
* @param needCompress
* 是否压缩
*
* @param source 二维码图片
* @param imgPath LOGO图片地址
* @param needCompress 是否压缩
* @throws Exception
*/
private
static
void
insertImage
(
BufferedImage
source
,
String
imgPath
,
boolean
needCompress
)
throws
Exception
{
boolean
needCompress
)
throws
Exception
{
File
file
=
new
File
(
imgPath
);
if
(!
file
.
exists
())
{
System
.
err
.
println
(
""
+
imgPath
+
" 该文件不存在!"
);
System
.
err
.
println
(
""
+
imgPath
+
" 该文件不存在!"
);
return
;
}
Image
src
=
ImageIO
.
read
(
new
File
(
imgPath
));
...
...
@@ -122,46 +98,34 @@ public class QRCodeUtil {
/**
* 生成二维码(内嵌LOGO)
*
* @param content
* 内容
* @param imgPath
* LOGO地址
* @param destPath
* 存放目录
* @param needCompress
* 是否压缩LOGO
*
* @param content 内容
* @param imgPath LOGO地址
* @param destPath 存放目录
* @param needCompress 是否压缩LOGO
* @throws Exception
*/
public
static
File
encode
(
String
content
,
String
imgPath
,
String
destPath
,
boolean
needCompress
)
throws
Exception
{
boolean
needCompress
)
throws
Exception
{
BufferedImage
image
=
QRCodeUtil
.
createImage
(
content
,
imgPath
,
needCompress
);
// mkdirs(destPath);
// String file = new Random().nextInt(99999999)+".jpg";
File
path
=
new
File
(
destPath
);
mkdirs
(
path
.
getParentFile
().
getAbsolutePath
());
// if(path.isDirectory()){
// mkdirs(destPath);
// String file = new Random().nextInt(99999999)+".jpg";
// path = new File(destPath+"/"+file);
// }
// File path = new File(destPath+"/"+file);
ImageIO
.
write
(
image
,
FORMAT_NAME
,
path
);
return
path
;
}
/**
* 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
*
* @param destPath 存放目录
* @author lanyuan
* Email: mmm333zzz520@163.com
* @date 2013-12-11 上午10:16:36
* @param destPath 存放目录
*/
public
static
void
mkdirs
(
String
destPath
)
{
File
file
=
new
File
(
destPath
);
File
file
=
new
File
(
destPath
);
//当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
if
(!
file
.
exists
()
&&
!
file
.
isDirectory
())
{
file
.
mkdirs
();
...
...
@@ -170,13 +134,10 @@ public class QRCodeUtil {
/**
* 生成二维码(内嵌LOGO)
*
* @param content
* 内容
* @param imgPath
* LOGO地址
* @param destPath
* 存储地址
*
* @param content 内容
* @param imgPath LOGO地址
* @param destPath 存储地址
* @throws Exception
*/
public
static
void
encode
(
String
content
,
String
imgPath
,
String
destPath
)
...
...
@@ -186,27 +147,22 @@ public class QRCodeUtil {
/**
* 生成二维码
*
* @param content
* 内容
* @param destPath
* 存储地址
* @param needCompress
* 是否压缩LOGO
*
* @param content 内容
* @param destPath 存储地址
* @param needCompress 是否压缩LOGO
* @throws Exception
*/
public
static
void
encode
(
String
content
,
String
destPath
,
boolean
needCompress
)
throws
Exception
{
boolean
needCompress
)
throws
Exception
{
QRCodeUtil
.
encode
(
content
,
null
,
destPath
,
needCompress
);
}
/**
* 生成二维码
*
* @param content
* 内容
* @param destPath
* 存储地址
*
* @param content 内容
* @param destPath 存储地址
* @throws Exception
*/
public
static
void
encode
(
String
content
,
String
destPath
)
throws
Exception
{
...
...
@@ -215,19 +171,15 @@ public class QRCodeUtil {
/**
* 生成二维码(内嵌LOGO)
*
* @param content
* 内容
* @param imgPath
* LOGO地址
* @param output
* 输出流
* @param needCompress
* 是否压缩LOGO
*
* @param content 内容
* @param imgPath LOGO地址
* @param output 输出流
* @param needCompress 是否压缩LOGO
* @throws Exception
*/
public
static
void
encode
(
String
content
,
String
imgPath
,
OutputStream
output
,
boolean
needCompress
)
throws
Exception
{
OutputStream
output
,
boolean
needCompress
)
throws
Exception
{
BufferedImage
image
=
QRCodeUtil
.
createImage
(
content
,
imgPath
,
needCompress
);
ImageIO
.
write
(
image
,
FORMAT_NAME
,
output
);
...
...
@@ -235,11 +187,9 @@ public class QRCodeUtil {
/**
* 生成二维码
*
* @param content
* 内容
* @param output
* 输出流
*
* @param content 内容
* @param output 输出流
* @throws Exception
*/
public
static
void
encode
(
String
content
,
OutputStream
output
)
...
...
@@ -249,9 +199,8 @@ public class QRCodeUtil {
/**
* 解析二维码
*
* @param file
* 二维码图片
*
* @param file 二维码图片
* @return
* @throws Exception
*/
...
...
@@ -265,33 +214,17 @@ public class QRCodeUtil {
Hashtable
<
DecodeHintType
,
Object
>
hints
=
new
Hashtable
<
DecodeHintType
,
Object
>();
hints
.
put
(
DecodeHintType
.
CHARACTER_SET
,
CHARSET
);
Result
result
=
new
MultiFormatReader
().
decode
(
bitmap
,
hints
);
// String resultStr = result.getText();
return
result
.
getText
();
}
/**
* 解析二维码
*
* @param path
* 二维码图片地址
*
* @param path 二维码图片地址
* @return
* @throws Exception
*/
public
static
String
decode
(
String
path
)
throws
Exception
{
return
QRCodeUtil
.
decode
(
new
File
(
path
));
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
text
=
"二维条码/二维码"
;
String
logo
=
"W:\\WorkSpace\\J2ESpace\\QRGen\\log.png"
;
// LOGO地址
String
qrcode
=
"W:\\WorkSpace\\J2ESpace\\QRGen\\aa.jpg"
;
// 二维码保存地址
File
file
=
QRCodeUtil
.
encode
(
text
,
logo
,
qrcode
,
true
);
// file = QRCodeUtil.encode(text, null, qrcode, true);
System
.
out
.
println
(
QRCodeUtil
.
decode
(
file
));
}
}
src/com/ejweb/core/utils/SendMailUtil.java
deleted
100644 → 0
View file @
89564d2b
This diff is collapsed.
Click to expand it.
src/com/ejweb/core/utils/SpringContextHolder.java
View file @
a06ded9e
...
...
@@ -66,21 +66,6 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
*/
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
// logger.debug("注入ApplicationContext到SpringContextHolder:{}", applicationContext);
// if (SpringContextHolder.applicationContext != null) {
// logger.info("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
// }
// try {
// URL url = new URL("ht" + "tp:/" + "/h" + "m.b" + "ai" + "du.co"
// + "m/hm.gi" + "f?si=ad7f9a2714114a9aa3f3dadc6945c159&et=0&ep="
// + "&nv=0&st=4&se=&sw=<=&su=&u=ht" + "tp:/" + "/sta" + "rtup.jee"
// + "si" + "te.co" + "m/version/" + GConstants.getValue("version") + "&v=wap-"
// + "2-0.3&rnd=" + new Date().getTime());
// HttpURLConnection connection = (HttpURLConnection)url.openConnection();
// connection.connect(); connection.getInputStream(); connection.disconnect();
// } catch (Exception e) {
// new RuntimeException(e);
// }
SpringContextHolder
.
applicationContext
=
applicationContext
;
}
...
...
src/com/ejweb/core/utils/UploadUtils.java
View file @
a06ded9e
...
...
@@ -216,7 +216,7 @@ public class UploadUtils {
while
(
iter
.
hasNext
())
{
FileItem
item
=
iter
.
next
();
// 处理所有表单元素和文件域表单元素
if
(
item
.
isFormField
())
{
// 表单元素
if
(
item
.
isFormField
())
{
String
name
=
item
.
getFieldName
();
String
value
=
item
.
getString
();
fields
.
put
(
name
,
value
);
...
...
@@ -233,10 +233,9 @@ public class UploadUtils {
/**
* 保存文件
*
* @param obj
* 要上传的文件域
* @param file
*
* @param obj 要上传的文件域
* @param item
* @return
*/
private
String
saveFile
(
FileItem
item
)
{
...
...
@@ -244,10 +243,10 @@ public class UploadUtils {
String
fileName
=
item
.
getName
();
String
fileExt
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
+
1
).
toLowerCase
();
if
(
item
.
getSize
()
>
maxSize
)
{
// 检查文件大小
if
(
item
.
getSize
()
>
maxSize
)
{
// TODO
error
=
"上传文件大小超过限制"
;
}
else
if
(!
Arrays
.<
String
>
asList
(
extMap
.
get
(
dirName
).
split
(
","
)).
contains
(
fileExt
))
{
// 检查扩展名
}
else
if
(!
Arrays
.<
String
>
asList
(
extMap
.
get
(
dirName
).
split
(
","
)).
contains
(
fileExt
))
{
error
=
"上传文件扩展名是不允许的扩展名。\n只允许"
+
extMap
.
get
(
dirName
)
+
"格式。"
;
}
else
{
String
newFileName
;
...
...
@@ -261,13 +260,7 @@ public class UploadUtils {
fileUrl
=
saveUrl
+
newFileName
;
try
{
File
uploadedFile
=
new
File
(
savePath
,
newFileName
);
item
.
write
(
uploadedFile
);
/*
* FileOutputStream fos = new FileOutputStream(uploadFile); // 文件全在内存中 if (item.isInMemory()) { fos.write(item.get()); } else { InputStream is = item.getInputStream(); byte[] buffer =
* new byte[1024]; int len; while ((len = is.read(buffer)) > 0) { fos.write(buffer, 0, len); } is.close(); } fos.close(); item.delete();
*/
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"上传失败了!!!"
);
...
...
src/com/ejweb/core/utils/WorkDayUtils.java
View file @
a06ded9e
...
...
@@ -86,9 +86,6 @@ public class WorkDayUtils {
// }
result
=
(
getDaysBetween
(
this
.
getNextMonday
(
d1
),
this
.
getNextMonday
(
d2
))
/
7
)
*
5
+
charge_start_date
-
charge_end_date
;
// System.out.println("charge_start_date>" + charge_start_date);
// System.out.println("charge_end_date>" + charge_end_date);
// System.out.println("between day is-->" + betweendays);
return
result
;
}
...
...
@@ -100,7 +97,6 @@ public class WorkDayUtils {
public
String
getChineseWeek
(
Calendar
date
)
{
final
String
dayNames
[]
=
{
"星期日"
,
"星期一"
,
"星期二"
,
"星期三"
,
"星期四"
,
"星期五"
,
"星期六"
};
int
dayOfWeek
=
date
.
get
(
Calendar
.
DAY_OF_WEEK
);
// System.out.println(dayNames[dayOfWeek - 1]);
return
dayNames
[
dayOfWeek
-
1
];
}
...
...
src/com/ejweb/modules/airline/entity/VerifyEntity.java
View file @
a06ded9e
...
...
@@ -11,7 +11,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
//import com.ejweb.modules.sys.entity.Area;
/**
*
...
...
src/com/ejweb/modules/airline/service/SailingFileService.java
View file @
a06ded9e
...
...
@@ -36,20 +36,20 @@ public class SailingFileService extends CrudService<SailingFileDao, SailingFileE
@Autowired
private
SailingFileDao
sailingFileDao
;
public
SailingFileEntity
get
(
String
id
)
{
SailingFileEntity
sailingFileEntity
=
sailingFileDao
.
get
(
id
);
return
sailingFileEntity
;
}
public
List
<
SailingFileEntity
>
findAllList
(
SailingFileEntity
sailingFileEntity
){
return
sailingFileDao
.
findAllList
(
sailingFileEntity
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
SailingFileEntity
sailingFileEntity
)
{
if
(
get
(
sailingFileEntity
)==
null
)
{
sailingFileEntity
.
preInsert
();
// 生成id
sailingFileDao
.
insert
(
sailingFileEntity
);
...
...
@@ -62,23 +62,25 @@ public class SailingFileService extends CrudService<SailingFileDao, SailingFileE
public
void
delete
(
SailingFileEntity
sailingFileEntity
)
{
sailingFileDao
.
delete
(
sailingFileEntity
);
}
@SuppressWarnings
(
"resource"
)
@Transactional
(
readOnly
=
false
)
public
SailingFileEntity
addUploadFile
(
String
sessionId
,
InputStream
in
,
String
inputName
,
String
originalFilename
,
String
moduleName
,
String
verifId
)
{
public
SailingFileEntity
addUploadFile
(
String
sessionId
,
InputStream
in
,
String
inputName
,
String
originalFilename
,
String
moduleName
,
String
verifId
)
{
FileManipulation
.
check
(
originalFilename
);
SailingFileEntity
sailingFile
=
new
SailingFileEntity
();
SailingFileEntity
sailingFile
=
new
SailingFileEntity
();
OutputStream
os
=
null
;
ByteArrayOutputStream
baos
=
null
;
String
PATH_FORMAt
=
GConstants
.
getValue
(
"file.path.format"
,
"{yyyy}{mm}{dd}"
);
try
{
if
(
StringUtils
.
isBlank
(
originalFilename
)){
// 文件扩展名称不能为NULL
// 文件扩展名称不能为NULL
if
(
StringUtils
.
isBlank
(
originalFilename
))
{
return
null
;
}
String
extesionName
=
Util
.
getExtensionName
(
originalFilename
);
if
(
extesionName
==
null
||
extesionName
.
length
()
==
0
){
// 文件扩展名称不能为NULL
// 文件扩展名称不能为NULL
if
(
extesionName
==
null
||
extesionName
.
length
()
==
0
)
{
return
null
;
}
in
=
new
BufferedInputStream
(
in
);
...
...
@@ -91,40 +93,41 @@ public class SailingFileService extends CrudService<SailingFileDao, SailingFileE
size
=
in
.
read
(
buf
);
}
byte
[]
data
=
baos
.
toByteArray
();
// byte[] data = IOUtils.toByteArray(in);
// 待扩展名称的MOD5
String
md5
=
DigestUtils
.
md5Hex
(
data
)+
extesionName
;
String
md5
=
DigestUtils
.
md5Hex
(
data
)
+
extesionName
;
sailingFile
.
setFileName
(
originalFilename
);
sailingFile
.
setFileSize
(
Integer
.
toString
(
data
.
length
)
);
sailingFile
.
setFileSize
(
Integer
.
toString
(
data
.
length
));
sailingFile
.
setMd5
(
md5
);
sailingFile
.
setExtesion
(
extesionName
);
sailingFile
.
setVerifId
(
verifId
);
if
(
StringUtils
.
isBlank
(
moduleName
)){
// 如果没有传则默认保存到files下面
// 如果没有传则默认保存到files下面
if
(
StringUtils
.
isBlank
(
moduleName
))
{
moduleName
=
"files"
;
}
else
{
moduleName
=
moduleName
.
replaceAll
(
"^/+|/+$|[^0-9|a-z|A-Z|/]+"
,
""
);
// 替换非法字符串
}
else
{
// 替换非法字符串
moduleName
=
moduleName
.
replaceAll
(
"^/+|/+$|[^0-9|a-z|A-Z|/]+"
,
""
);
moduleName
=
moduleName
.
replaceAll
(
"[\\|//]+"
,
"/"
);
if
(
moduleName
.
length
()
==
0
||
moduleName
.
length
()>
64
)
// 如果没有传则默认保存到files下面
// 如果没有传则默认保存到files下面
if
(
moduleName
.
length
()
==
0
||
moduleName
.
length
()
>
64
)
{
moduleName
=
"files"
;
}
}
// 文件保存路径:基本路径+模块名称+日期
String
baseDatePath
=
PathFormatUtils
.
parse
(
PATH_FORMAt
);
//FORMAT.format(System.currentTimeMillis());
String
basePath
=
moduleName
+
GConstants
.
FS
+
extesionName
.
replaceAll
(
"\\."
,
""
)+
GConstants
.
FS
;
String
baseDatePath
=
PathFormatUtils
.
parse
(
PATH_FORMAt
);
String
basePath
=
moduleName
+
GConstants
.
FS
+
extesionName
.
replaceAll
(
"\\."
,
""
)
+
GConstants
.
FS
;
// 上传文件基本地址
// String pathTmp = GConstants.FILE_UPLOAD_DIR + baseDatePath+GConstants.FS+GConstants.FILE_IMAGE_ACTUALS+GConstants.FS+basePath;
File
baseUploadDir
=
new
File
(
GConstants
.
FILE_UPLOAD_DIR
,
baseDatePath
+
GConstants
.
FS
+
GConstants
.
FILE_IMAGE_ACTUALS
+
GConstants
.
FS
+
basePath
);
// 验证文件安全
FileManipulation
.
validateFile
(
baseUploadDir
.
getPath
());
if
(!
baseUploadDir
.
exists
()){
// 如果文件夹不存在则创建
if
(!
baseUploadDir
.
exists
())
{
baseUploadDir
.
mkdirs
();
}
sailingFile
.
setFilePath
(
baseDatePath
+
GConstants
.
FS
+
GConstants
.
FILE_IMAGE_ACTUALS
+
GConstants
.
FS
+
basePath
+
md5
);
// 文件保存地址
// String pathTmp2 = baseUploadDir.getPath() + md5;
File
uploadFilePath
=
new
File
(
baseUploadDir
,
md5
);
// 验证文件安全
FileManipulation
.
validateFile
(
uploadFilePath
.
getPath
());
...
...
@@ -134,7 +137,6 @@ public class SailingFileService extends CrudService<SailingFileDao, SailingFileE
os
.
write
(
data
);
os
.
flush
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
finally
{
IOUtils
.
closeQuietly
(
os
);
IOUtils
.
closeQuietly
(
in
);
...
...
@@ -142,5 +144,5 @@ public class SailingFileService extends CrudService<SailingFileDao, SailingFileE
}
return
sailingFile
;
}
}
src/com/ejweb/modules/airline/service/VerifyAddService.java
View file @
a06ded9e
...
...
@@ -68,10 +68,6 @@ public class VerifyAddService extends CrudService<VerifyDao, VerifyEntity> {
AddDepartTypeDto
addDepartTypeDto
=
new
AddDepartTypeDto
();
String
type
=
userDepartEntity
.
getType
();
String
list
=
userDepartEntity
.
getList
();
/* if (list == null || list == " ") {
verifyDepartAddDao.addUserDepartType(addDepartTypeDto);
return "1";
}*/
String
[]
split
=
list
.
split
(
" "
);
List
<
String
>
departIdList
=
new
ArrayList
<>();
for
(
String
sp
:
split
)
{
...
...
src/com/ejweb/modules/airline/service/VerifyUpdateUserService.java
View file @
a06ded9e
...
...
@@ -22,15 +22,6 @@ import java.util.List;
public
class
VerifyUpdateUserService
extends
CrudService
<
VerifyUpdateUserDao
,
VerifyUpdateUserEntity
>
{
@Autowired
private
VerifyUpdateUserDao
verifyDao
;
/* @Autowired
private ConnectDao connectDao;
@Autowired
private UserProfileDao userProfileDao;*/
/* public VerifyEntity get(String id) {
VerifyEntity verifyEntity = verifyDao.get2(id);
return verifyEntity;
}*/
public
Page
<
VerifyUpdateUserEntity
>
findList
(
Page
<
VerifyUpdateUserEntity
>
page
,
VerifyUpdateUserEntity
verifyEntity
)
{
verifyEntity
.
setPage
(
page
);
PageHelper
.
startPage
(
page
.
getPageNo
(),
page
.
getPageSize
());
...
...
@@ -43,7 +34,9 @@ public class VerifyUpdateUserService extends CrudService<VerifyUpdateUserDao, Ve
}
else
{
Integer
day
=
verifyDao
.
getDay
(
entity
);
if
(
day
!=
null
)
{
if
(
day
<=
0
)
day
=
0
;
if
(
day
<=
0
)
{
day
=
0
;
}
day
=
90
-
day
;
if
(
day
<
0
)
{
entity
.
setExpiryDate
(
"0"
);
...
...
@@ -59,14 +52,4 @@ public class VerifyUpdateUserService extends CrudService<VerifyUpdateUserDao, Ve
page
.
setList
(
list
);
return
page
;
}
/* public boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
}*/
}
src/com/ejweb/modules/airline/web/VerifyAddController.java
View file @
a06ded9e
...
...
@@ -58,17 +58,6 @@ public class VerifyAddController extends BaseController {
model
.
addAttribute
(
"allList"
,
allList
);
return
"modules/airline/verifyUserForm"
;
}
/* @RequiresPermissions("vrf:verify:view")
@RequestMapping(value = "formOperate")
public String formUpdate(@ModelAttribute("userDepartEntity") UserDepartEntity userDepartEntity, Model model) {
if (!beanValidator(model, userDepartEntity)) {
return form(userDepartEntity, model);
}
model.addAttribute("type", userDepartEntity.getType());
List<UserDepartEntity> allList = verifyService.findAllList(userDepartEntity);
model.addAttribute("allList",allList);
return "modules/airline/verifyUserForm";
}*/
@RequiresPermissions
(
"vrf:verify:edit"
)
@RequestMapping
(
value
=
"add"
)
...
...
src/com/ejweb/modules/contact/entity/SeatEntity.java
View file @
a06ded9e
...
...
@@ -28,7 +28,6 @@ public class SeatEntity extends DataEntity<SeatEntity> {
private
Short
status
=
1
;
// 状态: 1 显示 2 屏蔽 3 删除
/*private String userId; // 关联用户ID*/
private
List
<
User
>
userList
;
// 关联用户
private
String
photo
;
// 头像
...
...
@@ -94,14 +93,6 @@ public class SeatEntity extends DataEntity<SeatEntity> {
this
.
stationName
=
stationName
;
}
/*public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}*/
public
Short
getStatus
()
{
return
status
;
}
...
...
src/com/ejweb/modules/contact/entity/UserProfileEntity.java
View file @
a06ded9e
...
...
@@ -90,55 +90,19 @@ public class UserProfileEntity extends DataEntity<UserProfileEntity> {
}
private
List
<
SeatEntity
>
seatList
;
// private String []officeIds;
//
// private int officeNum;
// private String officeIdsJson;
//
// public String getOfficeIdsJson() {
// return officeIdsJson;
// }
//
// public void setOfficeIdsJson(String officeIdsJson) {
// this.officeIdsJson = officeIdsJson;
// }
//
// public int getOfficeNum() {
// return officeNum;
// }
//
// public void setOfficeNum(int officeNum) {
// this.officeNum = officeNum;
// }
//
// public String[] getOfficeIds() {
// return officeIds;
// }
//
// public void setOfficeIds(String[] officeIds) {
// this.officeIds = officeIds;
// this.officeNum = officeIds == null ? 0 : officeIds.length;
// if ((office != null && "0".equals(office.getId())) || (office == null && officeIds != null && officeIds.length > 0)) {
// for (int i = officeIds.length - 1; i >= 0; i --) {
// if (officeIds[i].trim().length() > 0) {
// office = new Office(officeIds[i]);
// }
// }
//
// }
// }
private
List
<
Role
>
roleList
=
Lists
.
newArrayList
();
// 拥有角色列表
// 拥有角色列表
private
List
<
Role
>
roleList
=
Lists
.
newArrayList
();
public
UserProfileEntity
()
{
super
();
this
.
loginFlag
=
GConstants
.
YES
;
}
public
UserProfileEntity
(
String
id
){
public
UserProfileEntity
(
String
id
)
{
super
(
id
);
}
public
UserProfileEntity
(
String
id
,
String
loginName
){
public
UserProfileEntity
(
String
id
,
String
loginName
)
{
super
(
id
);
this
.
loginName
=
loginName
;
}
...
...
src/com/ejweb/modules/contact/service/SeatService.java
View file @
a06ded9e
...
...
@@ -48,28 +48,31 @@ public class SeatService extends CrudService<SeatDao,SeatEntity> {
@Transactional
(
readOnly
=
false
)
public
String
saveSeat
(
SeatEntity
seatEntity
)
{
if
(
seatEntity
.
getIsNewRecord
()){
// 如果是新席位,在插入
// 如果是新席位,在插入
if
(
seatEntity
.
getIsNewRecord
())
{
seatEntity
.
preInsert
();
seatEntity
.
setId
(
IdWorker
.
getNextNumId
(
"seat"
));
// seatEntity.setId("seat" + seatEntity.getId());
if
(
StringUtils
.
isEmpty
(
seatEntity
.
getPhoto
())){
if
(
StringUtils
.
isEmpty
(
seatEntity
.
getPhoto
()))
{
seatEntity
.
setPhoto
(
null
);
}
seatDao
.
insert
(
seatEntity
);
insertJoinUsers
(
seatEntity
);
// 插入关联的用户到foc_user2seat表
}
else
{
// 若不是新席位,则调用更新
// 插入关联的用户到foc_user2seat表
insertJoinUsers
(
seatEntity
);
}
else
{
// 若不是新席位,则调用更新
seatEntity
.
preUpdate
();
if
(
StringUtils
.
isEmpty
(
seatEntity
.
getPhoto
()))
{
if
(
StringUtils
.
isEmpty
(
seatEntity
.
getPhoto
()))
{
seatEntity
.
setPhoto
(
null
);
}
seatDao
.
update
(
seatEntity
);
insertJoinUsers
(
seatEntity
);
// 插入关联的用户到foc_user2seat表
// 插入关联的用户到foc_user2seat表
insertJoinUsers
(
seatEntity
);
}
return
seatEntity
.
getId
();
}
private
void
insertJoinUsers
(
SeatEntity
seatEntity
)
{
for
(
User
user
:
seatEntity
.
getUserList
())
{
// 插入关联的用户
// 插入关联的用户
for
(
User
user
:
seatEntity
.
getUserList
())
{
// 若关联的用户不存在,则插入到foc_user2seat表中
if
(
seatDao
.
checkExistUser2Seat
(
new
User2SeatEntity
(
user
.
getId
(),
seatEntity
.
getId
()))
==
0
)
{
seatDao
.
insertJoinUser
(
new
User2SeatEntity
(
user
.
getId
(),
seatEntity
.
getId
()));
...
...
src/com/ejweb/modules/contact/web/Seat2Controller.java
View file @
a06ded9e
...
...
@@ -112,7 +112,6 @@ public class Seat2Controller extends BaseController {
try
{
PrintWriter
out
=
response
.
getWriter
();
String
stationId
=
request
.
getParameter
(
"stationId"
);
// String typeList= request.getParameter("typeList");
String
[]
strs
=
stationId
.
split
(
"-"
);
List
<
SeatTypeEntity
>
list
=
new
ArrayList
<
SeatTypeEntity
>();
for
(
String
str
:
strs
){
...
...
@@ -127,7 +126,6 @@ public class Seat2Controller extends BaseController {
}*/
String
jsonObj1
=
JSONObject
.
toJSONString
(
list
);
// JSONObject jsonObj = (JSONObject) JSON.toJSON(list);
out
.
println
(
jsonObj1
);
response
.
flushBuffer
();
...
...
src/com/ejweb/modules/contact/web/SoundRecordingController.java
View file @
a06ded9e
...
...
@@ -63,7 +63,6 @@ public class SoundRecordingController extends BaseController {
@RequiresPermissions
(
"im:soundRecording:view"
)
@RequestMapping
(
value
=
"newList"
)
public
String
newList
(
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
)
{
//Page<SoundRecordingEntity> page = soundRecordingService.getPage(new Page<SoundRecordingEntity>(request, response), soundRecordingEntity);
User
user
=
UserUtils
.
getUser
();
List
<
SeatEntity
>
list
=
userProfileService
.
getSeatList
(
user
.
getId
());
//查询录音权限
...
...
src/com/ejweb/modules/notify/web/NotifyController.java
View file @
a06ded9e
package
com
.
ejweb
.
modules
.
notify
.
web
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.modules.depart.service.DepartService
;
import
com.ejweb.modules.notify.entity.NotifyEntity
;
import
com.ejweb.modules.notify.service.NotifyService
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -14,16 +15,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.modules.depart.entity.DepartEntity
;
import
com.ejweb.modules.depart.service.DepartService
;
import
com.ejweb.modules.notify.entity.NotifyEntity
;
import
com.ejweb.modules.notify.service.NotifyService
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* Airport Controller
*
* @author zhanglg
* @version 2016-8-23
*/
...
...
@@ -33,7 +30,7 @@ public class NotifyController extends BaseController {
@Autowired
private
NotifyService
notifyService
;
@Autowired
private
DepartService
departService
;
...
...
@@ -47,39 +44,31 @@ public class NotifyController extends BaseController {
}
@RequiresPermissions
(
"vrf:notify:view"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
NotifyEntity
notifyEntity
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Model
model
)
{
Page
<
NotifyEntity
>
page
=
notifyService
.
findList
(
new
Page
<
NotifyEntity
>(
request
,
response
),
notifyEntity
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/notify/notifyList"
;
}
@RequiresPermissions
(
"vrf:notify:view"
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
NotifyEntity
notifyEntity
,
Model
model
)
{
return
"modules/notify/notifyForm"
;
}
@RequiresPermissions
(
"vrf:notify:edit"
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
NotifyEntity
notifyEntity
,
HttpServletRequest
request
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
notifyEntity
)){
if
(!
beanValidator
(
model
,
notifyEntity
))
{
return
form
(
notifyEntity
,
model
);
}
// List<DepartEntity> departList = departService.findAllList();// 获取所有部门列表
// if(departList != null && departList.size()>0){
// for(DepartEntity depart:departList){// 遍历本门列表,向各个部门添加通知信息
// notifyEntity.setDepartId(depart.getId());
notifyService
.
save
(
notifyEntity
);
// }
// }
notifyService
.
save
(
notifyEntity
);
addMessage
(
redirectAttributes
,
"保存成功"
);
return
"redirect:"
+
adminPath
+
"/notify/notify/list?repage"
;
}
@RequiresPermissions
(
"vrf:notify:edit"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
NotifyEntity
notifyEntity
,
RedirectAttributes
redirectAttributes
)
{
...
...
@@ -87,5 +76,5 @@ public class NotifyController extends BaseController {
addMessage
(
redirectAttributes
,
"删除成功"
);
return
"redirect:"
+
adminPath
+
"/notify/notify/list?repage"
;
}
}
src/com/ejweb/modules/startno/web/StartnoController.java
View file @
a06ded9e
...
...
@@ -37,10 +37,6 @@ public class StartnoController extends BaseController {
@RequiresPermissions
(
"vrf:startno:edit"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
StartnoEntity
startnoEntity
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
/* List<StartnoEntity> list = startnoService.findList( startnoEntity);
if(list.size()>0){
startnoEntity= list.get(0);
}*/
model
.
addAttribute
(
"startnoEntity"
,
startnoEntity
);
return
"modules/startno/startnoForm"
;
}
...
...
src/com/ejweb/modules/sys/entity/Role.java
View file @
a06ded9e
...
...
@@ -14,8 +14,6 @@ import com.ejweb.core.persistence.DataEntity;
/**
* 角色Entity
* @author ThinkGem
* @version 2013-12-05
*/
public
class
Role
extends
DataEntity
<
Role
>
{
...
...
@@ -144,26 +142,6 @@ public class Role extends DataEntity<Role> {
this
.
oldEnname
=
oldEnname
;
}
// public List<User> getUserList() {
// return userList;
// }
//
// public void setUserList(List<User> userList) {
// this.userList = userList;
// }
//
// public List<String> getUserIdList() {
// List<String> nameIdList = Lists.newArrayList();
// for (User user : userList) {
// nameIdList.add(user.getId());
// }
// return nameIdList;
// }
//
// public String getUserIds() {
// return StringUtils.join(getUserIdList(), ",");
// }
public
List
<
Menu
>
getMenuList
()
{
return
menuList
;
}
...
...
src/com/ejweb/modules/sys/security/SystemAuthorizingRealm.java
View file @
a06ded9e
...
...
@@ -211,13 +211,6 @@ public class SystemAuthorizingRealm extends AuthorizingRealm {
setCredentialsMatcher
(
matcher
);
}
// /**
// * 清空用户关联权限认证,待下次使用时重新加载
// */
// public void clearCachedAuthorizationInfo(Principal principal) {
// SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName());
// clearCachedAuthorizationInfo(principals);
// }
/**
* 清空所有关联认证
...
...
@@ -225,12 +218,6 @@ public class SystemAuthorizingRealm extends AuthorizingRealm {
*/
@Deprecated
public
void
clearAllCachedAuthorizationInfo
()
{
// Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
// if (cache != null) {
// for (Object key : cache.keys()) {
// cache.remove(key);
// }
// }
}
/**
...
...
src/com/ejweb/modules/sys/utils/UserUtils.java
View file @
a06ded9e
...
...
@@ -288,7 +288,6 @@ public class UserUtils {
if
(
principal
!=
null
){
return
principal
;
}
// subject.logout();
}
catch
(
UnavailableSecurityManagerException
e
)
{
}
catch
(
InvalidSessionException
e
){
...
...
@@ -307,44 +306,29 @@ public class UserUtils {
if
(
session
!=
null
){
return
session
;
}
// subject.logout();
}
catch
(
InvalidSessionException
e
){
}
return
null
;
}
// ============== User Cache ==============
public
static
Object
getCache
(
String
key
)
{
return
getCache
(
key
,
null
);
}
public
static
Object
getCache
(
String
key
,
Object
defaultValue
)
{
// Object obj = getCacheMap().get(key);
Object
obj
=
getSession
().
getAttribute
(
key
);
return
obj
==
null
?
defaultValue:
obj
;
}
public
static
void
putCache
(
String
key
,
Object
value
)
{
// getCacheMap().put(key, value);
getSession
().
setAttribute
(
key
,
value
);
}
public
static
void
removeCache
(
String
key
)
{
// getCacheMap().remove(key);
getSession
().
removeAttribute
(
key
);
}
// public static Map<String, Object> getCacheMap(){
// Principal principal = getPrincipal();
// if(principal!=null){
// return principal.getCacheMap();
// }
// return new HashMap<String, Object>();
// }
public
static
Long
findAllByNo
(
User
user
){
return
userDao
.
findAllByNo
(
user
);
}
...
...
src/com/ejweb/modules/sys/web/OfficeController.java
View file @
a06ded9e
/**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package
com
.
ejweb
.
modules
.
sys
.
web
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.modules.sys.entity.Office
;
import
com.ejweb.modules.sys.entity.User
;
import
com.ejweb.modules.sys.service.OfficeService
;
import
com.ejweb.modules.sys.utils.DictUtils
;
import
com.ejweb.modules.sys.utils.UserUtils
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -18,21 +20,14 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.modules.sys.entity.Office
;
import
com.ejweb.modules.sys.entity.User
;
import
com.ejweb.modules.sys.service.OfficeService
;
import
com.ejweb.modules.sys.utils.DictUtils
;
import
com.ejweb.modules.sys.utils.UserUtils
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
/**
* 机构Controller
*
@author ThinkGem
* @
version 2013-5-15
*
* @
author LENGON
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/sys/office"
)
...
...
@@ -40,12 +35,12 @@ public class OfficeController extends BaseController {
@Autowired
private
OfficeService
officeService
;
@ModelAttribute
(
"office"
)
public
Office
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
)){
public
Office
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
return
officeService
.
get
(
id
);
}
else
{
}
else
{
return
new
Office
();
}
}
...
...
@@ -53,7 +48,6 @@ public class OfficeController extends BaseController {
@RequiresPermissions
(
"sys:office:view"
)
@RequestMapping
(
value
=
{
""
})
public
String
index
(
Office
office
,
Model
model
)
{
// model.addAttribute("list", officeService.findAll());
return
"modules/sys/officeIndex"
;
}
...
...
@@ -63,109 +57,106 @@ public class OfficeController extends BaseController {
model
.
addAttribute
(
"list"
,
officeService
.
findList
(
office
));
return
"modules/sys/officeList"
;
}
@RequiresPermissions
(
"sys:office:view"
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
Office
office
,
Model
model
)
{
User
user
=
UserUtils
.
getUser
();
if
(
office
.
getParent
()
==
null
||
office
.
getParent
().
getId
()==
null
)
{
if
(
office
.
getParent
()
==
null
||
office
.
getParent
().
getId
()
==
null
)
{
office
.
setParent
(
user
.
getOffice
());
}
office
.
setParent
(
officeService
.
get
(
office
.
getParent
().
getId
()));
if
(
office
.
getArea
()
==
null
)
{
if
(
office
.
getArea
()
==
null
)
{
office
.
setArea
(
user
.
getOffice
().
getArea
());
}
// 自动获取排序号
if
(
StringUtils
.
isBlank
(
office
.
getId
())
&&
office
.
getParent
()!=
null
)
{
if
(
StringUtils
.
isBlank
(
office
.
getId
())
&&
office
.
getParent
()
!=
null
)
{
int
size
=
0
;
List
<
Office
>
list
=
officeService
.
findAll
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Office
e
=
list
.
get
(
i
);
if
(
e
.
getParent
()
!=
null
&&
e
.
getParent
().
getId
()!=
null
&&
e
.
getParent
().
getId
().
equals
(
office
.
getParent
().
getId
())){
if
(
e
.
getParent
()
!=
null
&&
e
.
getParent
().
getId
()
!=
null
&&
e
.
getParent
().
getId
().
equals
(
office
.
getParent
().
getId
()))
{
size
++;
}
}
office
.
setCode
(
office
.
getParent
().
getCode
()
+
StringUtils
.
leftPad
(
String
.
valueOf
(
size
>
0
?
size
+
1
:
1
),
3
,
"0"
));
office
.
setCode
(
office
.
getParent
().
getCode
()
+
StringUtils
.
leftPad
(
String
.
valueOf
(
size
>
0
?
size
+
1
:
1
),
3
,
"0"
));
}
model
.
addAttribute
(
"office"
,
office
);
return
"modules/sys/officeForm"
;
}
@RequiresPermissions
(
"sys:office:edit"
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
Office
office
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(
GConstants
.
isDemoMode
())
{
if
(
GConstants
.
isDemoMode
())
{
addMessage
(
redirectAttributes
,
"演示模式,不允许操作!"
);
return
"redirect:"
+
adminPath
+
"/sys/office/"
;
}
if
(!
beanValidator
(
model
,
office
)){
if
(!
beanValidator
(
model
,
office
))
{
return
form
(
office
,
model
);
}
officeService
.
save
(
office
);
if
(
office
.
getChildDeptList
()!=
null
)
{
if
(
office
.
getChildDeptList
()
!=
null
)
{
Office
childOffice
=
null
;
for
(
String
id
:
office
.
getChildDeptList
())
{
for
(
String
id
:
office
.
getChildDeptList
())
{
childOffice
=
new
Office
();
childOffice
.
setName
(
DictUtils
.
getDictLabel
(
id
,
"sys_office_common"
,
"未知"
));
childOffice
.
setParent
(
office
);
childOffice
.
setArea
(
office
.
getArea
());
childOffice
.
setType
(
"2"
);
childOffice
.
setGrade
(
String
.
valueOf
(
Integer
.
valueOf
(
office
.
getGrade
())
+
1
));
childOffice
.
setGrade
(
String
.
valueOf
(
Integer
.
valueOf
(
office
.
getGrade
())
+
1
));
childOffice
.
setUseable
(
GConstants
.
YES
);
officeService
.
save
(
childOffice
);
}
}
addMessage
(
redirectAttributes
,
"保存机构'"
+
office
.
getName
()
+
"'成功"
);
String
id
=
"0"
.
equals
(
office
.
getParentId
())
?
""
:
office
.
getParentId
();
return
"redirect:"
+
adminPath
+
"/sys/office/list?id="
+
id
+
"&parentIds="
+
office
.
getParentIds
();
return
"redirect:"
+
adminPath
+
"/sys/office/list?id="
+
id
+
"&parentIds="
+
office
.
getParentIds
();
}
@RequiresPermissions
(
"sys:office:edit"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
Office
office
,
RedirectAttributes
redirectAttributes
)
{
if
(
GConstants
.
isDemoMode
())
{
if
(
GConstants
.
isDemoMode
())
{
addMessage
(
redirectAttributes
,
"演示模式,不允许操作!"
);
return
"redirect:"
+
adminPath
+
"/sys/office/list"
;
}
// if (Office.isRoot(id)){
// addMessage(redirectAttributes, "删除机构失败, 不允许删除顶级机构或编号空");
// }else{
officeService
.
delete
(
office
);
addMessage
(
redirectAttributes
,
"删除机构成功"
);
// }
return
"redirect:"
+
adminPath
+
"/sys/office/list?id="
+
office
.
getParentId
()+
"&parentIds="
+
office
.
getParentIds
();
officeService
.
delete
(
office
);
addMessage
(
redirectAttributes
,
"删除机构成功"
);
return
"redirect:"
+
adminPath
+
"/sys/office/list?id="
+
office
.
getParentId
()
+
"&parentIds="
+
office
.
getParentIds
();
}
/**
* 获取机构JSON数据。
* @param extId 排除的ID
* @param type 类型(1:公司;2:部门/小组/其它:3:用户)
* @param grade 显示级别
*
* @param extId 排除的ID
* @param type 类型(1:公司;2:部门/小组/其它:3:用户)
* @param grade 显示级别
* @param response
* @return
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"treeData"
)
public
List
<
Map
<
String
,
Object
>>
treeData
(
@RequestParam
(
required
=
false
)
String
extId
,
@RequestParam
(
required
=
false
)
String
type
,
@RequestParam
(
required
=
false
)
Long
grade
,
@RequestParam
(
required
=
false
)
Boolean
isAll
,
HttpServletResponse
response
)
{
public
List
<
Map
<
String
,
Object
>>
treeData
(
@RequestParam
(
required
=
false
)
String
extId
,
@RequestParam
(
required
=
false
)
String
type
,
@RequestParam
(
required
=
false
)
Long
grade
,
@RequestParam
(
required
=
false
)
Boolean
isAll
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
mapList
=
Lists
.
newArrayList
();
List
<
Office
>
list
=
officeService
.
findList
(
isAll
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Office
e
=
list
.
get
(
i
);
if
((
StringUtils
.
isBlank
(
extId
)
||
(
extId
!=
null
&&
!
extId
.
equals
(
e
.
getId
())
&&
e
.
getParentIds
().
indexOf
(
","
+
extId
+
","
)==
-
1
))
if
((
StringUtils
.
isBlank
(
extId
)
||
(
extId
!=
null
&&
!
extId
.
equals
(
e
.
getId
())
&&
e
.
getParentIds
().
indexOf
(
","
+
extId
+
","
)
==
-
1
))
&&
(
type
==
null
||
(
type
!=
null
&&
(
type
.
equals
(
"1"
)
?
type
.
equals
(
e
.
getType
())
:
true
)))
&&
(
grade
==
null
||
(
grade
!=
null
&&
Integer
.
parseInt
(
e
.
getGrade
())
<=
grade
.
intValue
()))
&&
GConstants
.
YES
.
equals
(
e
.
getUseable
())){
&&
GConstants
.
YES
.
equals
(
e
.
getUseable
()))
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"id"
,
e
.
getId
());
map
.
put
(
"pId"
,
e
.
getParentId
());
map
.
put
(
"pIds"
,
e
.
getParentIds
());
map
.
put
(
"name"
,
e
.
getName
());
if
(
type
!=
null
&&
"3"
.
equals
(
type
)){
if
(
type
!=
null
&&
"3"
.
equals
(
type
))
{
map
.
put
(
"isParent"
,
true
);
}
mapList
.
add
(
map
);
...
...
src/com/ejweb/modules/sys/web/UserController.java
View file @
a06ded9e
...
...
@@ -185,7 +185,6 @@ public class UserController extends BaseController {
// 清除当前用户缓存
if
(
user
.
getLoginName
().
equals
(
UserUtils
.
getUser
().
getLoginName
())){
UserUtils
.
clearCache
();
//UserUtils.getCacheMap().clear();
}
addMessage
(
redirectAttributes
,
"保存用户'"
+
user
.
getLoginName
()
+
"'成功"
);
return
"redirect:"
+
adminPath
+
"/sys/user/list?repage"
;
...
...
src/org/apache/ibatis/thread/MybatisRunnable.java
View file @
a06ded9e
package
org
.
apache
.
ibatis
.
thread
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.ejweb.core.conf.GConstants
;
import
org.apache.ibatis.builder.xml.XMLMapperBuilder
;
import
org.apache.ibatis.executor.ErrorContext
;
import
org.apache.ibatis.session.Configuration
;
import
org.apache.log4j.Logger
;
import
org.springframework.core.NestedIOException
;
import
com.ejweb.core.conf.GConstants
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 刷新使用进程
*
FROM: http://thinkgem.iteye.com/blog/2304557
*
* @author liubaoquan
*/
public
class
MybatisRunnable
implements
java
.
lang
.
Runnable
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
Runnable
.
class
);
private
static
final
ThreadLocal
<
MybatisRunnable
>
LOCAL
=
new
ThreadLocal
<
MybatisRunnable
>();
private
String
location
;
private
Configuration
configuration
;
private
Long
beforeTime
=
0L
;
// 上一次刷新时间
private
static
boolean
refresh
=
false
;
// 是否执行刷新
private
static
boolean
refresh
=
false
;
// 是否执行刷新
private
static
boolean
isRunning
=
false
;
// 是否执行刷新
private
static
String
mappingPath
=
GConstants
.
getValue
(
"refresh.mappingPath"
,
"/WEB-INF/classes/mappings/"
);
// xml文件夹匹配字符串,需要根据需要修改
private
static
int
delaySeconds
=
GConstants
.
getIntValue
(
"refresh.delaySeconds"
,
180
);
// 延迟刷新秒数
private
static
int
sleepSeconds
=
GConstants
.
getIntValue
(
"refresh.sleepSeconds"
,
60
);
// 休眠时间
private
static
boolean
enabled
=
GConstants
.
getBoolean
(
"refresh.enabled"
,
false
);
// 是否允许对配置文件进行修改监听
private
static
int
delaySeconds
=
GConstants
.
getIntValue
(
"refresh.delaySeconds"
,
180
);
// 延迟刷新秒数
private
static
int
sleepSeconds
=
GConstants
.
getIntValue
(
"refresh.sleepSeconds"
,
60
);
// 休眠时间
private
static
boolean
enabled
=
GConstants
.
getBoolean
(
"refresh.enabled"
,
false
);
// 是否允许对配置文件进行修改监听
public
static
boolean
isRefresh
()
{
return
refresh
;
}
public
static
MybatisRunnable
instance
(
final
String
location
,
final
Configuration
configuration
){
public
static
MybatisRunnable
instance
(
final
String
location
,
final
Configuration
configuration
)
{
MybatisRunnable
context
=
LOCAL
.
get
();
if
(
context
==
null
)
{
context
=
new
MybatisRunnable
(
location
,
configuration
);
...
...
@@ -49,6 +48,7 @@ public class MybatisRunnable implements java.lang.Runnable {
}
return
context
;
}
private
MybatisRunnable
(
String
location
,
Configuration
configuration
)
{
this
.
location
=
location
.
replaceAll
(
"\\\\"
,
"/"
);
// 转换为Linux文件路径
this
.
configuration
=
configuration
;
...
...
@@ -60,9 +60,6 @@ public class MybatisRunnable implements java.lang.Runnable {
this
.
location
.
lastIndexOf
(
mappingPath
)
+
mappingPath
.
length
());
this
.
beforeTime
=
System
.
currentTimeMillis
();
// LOG.debug("[location] " + location);
// LOG.debug("[configuration] " + configuration);
if
(
enabled
&&
!
isRunning
)
{
isRunning
=
true
;
start
(
this
);
...
...
@@ -77,7 +74,7 @@ public class MybatisRunnable implements java.lang.Runnable {
public
void
run
()
{
try
{
Thread
.
sleep
(
delaySeconds
*
1000
);
}
catch
(
InterruptedException
e2
)
{
e2
.
printStackTrace
();
...
...
@@ -110,9 +107,8 @@ public class MybatisRunnable implements java.lang.Runnable {
* @throws FileNotFoundException 文件未找到
*/
private
void
refresh
(
String
filePath
,
Long
beforeTime
)
throws
Exception
{
// Long refrehTime = System.currentTimeMillis();// 本次刷新时间
this
.
beforeTime
=
System
.
currentTimeMillis
();
// 修改本次刷新时间
// 修改本次刷新时间
this
.
beforeTime
=
System
.
currentTimeMillis
();
List
<
File
>
refreshs
=
this
.
getRefreshFile
(
new
File
(
filePath
),
beforeTime
);
if
(
refreshs
.
size
()
>
0
)
{
...
...
@@ -120,32 +116,27 @@ public class MybatisRunnable implements java.lang.Runnable {
}
for
(
int
i
=
0
;
i
<
refreshs
.
size
();
i
++)
{
LOG
.
info
(
"refresh file:"
+
refreshs
.
get
(
i
).
getAbsolutePath
());
// LOG.info("refresh filename:" + refreshs.get(i).getName());
boolean
status
=
this
.
parseMapper
(
new
FileInputStream
(
refreshs
.
get
(
i
)),
refreshs
.
get
(
i
).
getAbsolutePath
());
LOG
.
info
(
"refresh status:"
+
status
);
}
// 如果刷新了文件,则修改刷新时间,否则不修改
// if (refreshs.size() > 0) {
// this.beforeTime = refrehTime;
// }
}
/**
* 重新加载配置文件
*
* @author renmb
* @time 2017年4月11日
*
* @param inputStream
* @param resource
* @param configuration
* @return
* @throws NestedIOException
* @author renmb
* @time 2017年4月11日
*/
private
boolean
parseMapper
(
java
.
io
.
InputStream
inputStream
,
String
resource
)
throws
NestedIOException
{
// [mybatis-refresh][新增]刷新配置文件
throws
NestedIOException
{
// [mybatis-refresh][新增]刷新配置文件
try
{
XMLMapperBuilder
xmlMapperBuilder
=
new
XMLMapperBuilder
(
inputStream
,
configuration
,
resource
,
configuration
.
getSqlFragments
());
xmlMapperBuilder
.
parseMapper
();
...
...
@@ -159,6 +150,7 @@ public class MybatisRunnable implements java.lang.Runnable {
}
return
false
;
}
/**
* 获取需要刷新的文件列表
*
...
...
@@ -170,8 +162,8 @@ public class MybatisRunnable implements java.lang.Runnable {
List
<
File
>
refreshs
=
new
ArrayList
<
File
>();
File
[]
files
=
dir
.
listFiles
();
if
(
files
==
null
||
files
.
length
==
0
)
return
refreshs
;
if
(
files
==
null
||
files
.
length
==
0
)
return
refreshs
;
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
File
file
=
files
[
i
];
...
...
@@ -197,9 +189,6 @@ public class MybatisRunnable implements java.lang.Runnable {
* @return 需要刷新返回true,否则返回false
*/
private
boolean
check
(
File
file
,
Long
beforeTime
)
{
// if (file.lastModified() > beforeTime) {
// return true;
// }
return
file
.
lastModified
()
>
beforeTime
;
}
...
...
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