Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloudV3.0
Commits
e344509c
Commit
e344509c
authored
Oct 22, 2018
by
HuangBingGui
Browse files
删除目录JeeSpringCloud
parent
51016ad9
Changes
393
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 393+
files are displayed.
Plain diff
Email patch
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/entity/MailPage.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.iim.entity
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.jeespring.common.persistence.Page
;
public
class
MailPage
<
T
>
extends
Page
<
T
>{
public
MailPage
(
HttpServletRequest
request
,
HttpServletResponse
response
){
super
(
request
,
response
,
-
2
);
}
/**
* 默认输出当前分页标签
* <div class="page">${page}</div>
*/
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"<div class=\"row\">"
);
sb
.
append
(
"<div class=\"col-sm-12\">"
);
sb
.
append
(
"<div class=\"dataTables_paginate paging_simple_numbers\">"
);
sb
.
append
(
"<ul class=\"pagination\">"
);
if
(
pageNo
==
first
)
{
// 如果是首页
sb
.
append
(
"<li class=\"paginate_button previous disabled\"><a href=\"javascript:\">上一页</a></li>\n"
);
}
else
{
sb
.
append
(
"<li class=\"paginate_button previous\"><a href=\"javascript:\" onclick=\""
+
funcName
+
"("
+
prev
+
","
+
pageSize
+
",'"
+
funcParam
+
"');\">上一页</a></li>\n"
);
}
int
begin
=
pageNo
-
(
length
/
2
);
if
(
begin
<
first
)
{
begin
=
first
;
}
int
end
=
begin
+
length
-
1
;
if
(
end
>=
last
)
{
end
=
last
;
begin
=
end
-
length
+
1
;
if
(
begin
<
first
)
{
begin
=
first
;
}
}
if
(
begin
>
first
)
{
int
i
=
0
;
for
(
i
=
first
;
i
<
first
+
slider
&&
i
<
begin
;
i
++)
{
sb
.
append
(
"<li class=\"paginate_button \"><a href=\"javascript:\" onclick=\""
+
funcName
+
"("
+
i
+
","
+
pageSize
+
",'"
+
funcParam
+
"');\">"
+
(
i
+
1
-
first
)
+
"</a></li>\n"
);
}
if
(
i
<
begin
)
{
sb
.
append
(
"<li class=\"paginate_button disabled\"><a href=\"javascript:\">...</a></li>\n"
);
}
}
for
(
int
i
=
begin
;
i
<=
end
;
i
++)
{
if
(
i
==
pageNo
)
{
sb
.
append
(
"<li class=\"paginate_button active\"><a href=\"javascript:\">"
+
(
i
+
1
-
first
)
+
"</a></li>\n"
);
}
else
{
sb
.
append
(
"<li class=\"paginate_button \"><a href=\"javascript:\" onclick=\""
+
funcName
+
"("
+
i
+
","
+
pageSize
+
",'"
+
funcParam
+
"');\">"
+
(
i
+
1
-
first
)
+
"</a></li>\n"
);
}
}
if
(
last
-
end
>
slider
)
{
sb
.
append
(
"<li class=\"paginate_button disabled\"><a href=\"javascript:\">...</a></li>\n"
);
end
=
last
-
slider
;
}
for
(
int
i
=
end
+
1
;
i
<=
last
;
i
++)
{
sb
.
append
(
"<li class=\"paginate_button \"><a href=\"javascript:\" onclick=\""
+
funcName
+
"("
+
i
+
","
+
pageSize
+
",'"
+
funcParam
+
"');\">"
+
(
i
+
1
-
first
)
+
"</a></li>\n"
);
}
if
(
pageNo
==
last
)
{
sb
.
append
(
"<li class=\"paginate_button next disabled\"><a href=\"javascript:\">下一页 </a></li>\n"
);
}
else
{
sb
.
append
(
"<li class=\"paginate_button next\"><a href=\"javascript:\" onclick=\""
+
funcName
+
"("
+
next
+
","
+
pageSize
+
",'"
+
funcParam
+
"');\">"
+
"下一页</a></li>\n"
);
}
sb
.
append
(
"<li> <select onChange=\""
+
funcName
+
"("
+
pageNo
+
",this.value,'"
+
funcParam
+
"');\""
+
" style=\"height:28px;\" class=\"btn-sm\">"
+
"<option value=\"10\" "
+
getSelected
(
pageSize
,
10
)+
">10</option>"
+
"<option value=\"25\" "
+
getSelected
(
pageSize
,
25
)+
">25</option>"
+
"<option value=\"50\" "
+
getSelected
(
pageSize
,
50
)+
">50</option>"
+
"<option value=\"100\" "
+
getSelected
(
pageSize
,
100
)+
">100</option>"
+
"</select> </li>\n"
);
sb
.
append
(
"</ul>"
);
sb
.
append
(
"</div>"
);
sb
.
append
(
"</div>"
);
sb
.
append
(
"</div>"
);
// sb.insert(0,"<ul>\n").append("</ul>\n");
// sb.append("<div style=\"clear:both;\"></div>");
// sb.insert(0,"<div class=\"page\">\n").append("</div>\n");
return
sb
.
toString
();
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/entity/MyCalendar.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com.jeespring.modules.iim.entity
;
import
org.hibernate.validator.constraints.Length
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
import
com.jeespring.modules.sys.entity.User
;
/**
* 日历Entity
* @author liugf
* @version 2016-04-19
*/
public
class
MyCalendar
extends
AbstractBaseEntity
<
MyCalendar
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
title
;
// 事件标题
private
String
start
;
// 事件开始时间
private
String
end
;
// 事件结束时间
private
String
adllDay
;
// 是否为全天时间
private
String
color
;
// 时间的背景色
private
User
user
;
// 所属用户
public
MyCalendar
()
{
super
();
}
public
MyCalendar
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"事件标题长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"事件标题"
,
align
=
2
,
sort
=
1
)
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"事件开始时间长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"事件开始时间"
,
align
=
2
,
sort
=
2
)
public
String
getStart
()
{
return
start
;
}
public
void
setStart
(
String
start
)
{
this
.
start
=
start
;
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"事件结束时间长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"事件结束时间"
,
align
=
2
,
sort
=
3
)
public
String
getEnd
()
{
return
end
;
}
public
void
setEnd
(
String
end
)
{
this
.
end
=
end
;
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"是否为全天时间长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"是否为全天时间"
,
align
=
2
,
sort
=
4
)
public
String
getAdllDay
()
{
return
adllDay
;
}
public
void
setAdllDay
(
String
adllDay
)
{
this
.
adllDay
=
adllDay
;
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"时间的背景色长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"时间的背景色"
,
align
=
2
,
sort
=
5
)
public
String
getColor
()
{
return
color
;
}
public
void
setColor
(
String
color
)
{
this
.
color
=
color
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
User
getUser
()
{
return
user
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/service/ChatHistoryService.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.iim.dao.ChatHistoryDao
;
import
com.jeespring.modules.iim.entity.ChatHistory
;
/**
* 聊天记录Service
* @author 黄炳桂 516821420@qq.com
* @version 2015-12-29
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
ChatHistoryService
extends
AbstractBaseService
<
ChatHistoryDao
,
ChatHistory
>
{
public
ChatHistory
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
ChatHistory
>
findList
(
ChatHistory
chatHistory
)
{
return
super
.
findList
(
chatHistory
);
}
public
Page
<
ChatHistory
>
findPage
(
Page
<
ChatHistory
>
page
,
ChatHistory
entity
)
{
entity
.
setPage
(
page
);
page
.
setList
(
dao
.
findLogList
(
entity
));
return
page
;
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
ChatHistory
chatHistory
)
{
super
.
save
(
chatHistory
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
ChatHistory
chatHistory
)
{
super
.
delete
(
chatHistory
);
}
public
int
findUnReadCount
(
ChatHistory
chatHistory
){
return
dao
.
findUnReadCount
(
chatHistory
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/service/MailBoxService.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.service
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.iim.dao.MailBoxDao
;
import
com.jeespring.modules.iim.entity.MailBox
;
import
com.jeespring.modules.iim.entity.MailPage
;
/**
* 收件箱Service
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-13
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
MailBoxService
extends
AbstractBaseService
<
MailBoxDao
,
MailBox
>
{
@Autowired
private
MailBoxDao
mailBoxDao
;
public
MailBox
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
MailBox
>
findList
(
MailBox
mailBox
)
{
return
super
.
findList
(
mailBox
);
}
public
Page
<
MailBox
>
findPage
(
MailPage
<
MailBox
>
page
,
MailBox
mailBox
)
{
return
super
.
findPage
(
page
,
mailBox
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
MailBox
mailBox
)
{
super
.
save
(
mailBox
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
MailBox
mailBox
)
{
super
.
delete
(
mailBox
);
}
public
int
getCount
(
MailBox
mailBox
)
{
return
mailBoxDao
.
getCount
(
mailBox
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/service/MailComposeService.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.service
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.iim.dao.MailComposeDao
;
import
com.jeespring.modules.iim.entity.MailCompose
;
import
com.jeespring.modules.iim.entity.MailPage
;
/**
* 发件箱Service
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-13
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
MailComposeService
extends
AbstractBaseService
<
MailComposeDao
,
MailCompose
>
{
@Autowired
private
MailComposeDao
mailComposeDao
;
public
MailCompose
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
MailCompose
>
findList
(
MailCompose
mailCompose
)
{
return
super
.
findList
(
mailCompose
);
}
public
Page
<
MailCompose
>
findPage
(
MailPage
<
MailCompose
>
page
,
MailCompose
mailCompose
)
{
return
super
.
findPage
(
page
,
mailCompose
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
MailCompose
mailCompose
)
{
super
.
save
(
mailCompose
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
MailCompose
mailCompose
)
{
super
.
delete
(
mailCompose
);
}
public
int
getCount
(
MailCompose
mailCompose
)
{
return
mailComposeDao
.
getCount
(
mailCompose
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/service/MailService.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.service
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.iim.dao.MailBoxDao
;
import
com.jeespring.modules.iim.dao.MailComposeDao
;
import
com.jeespring.modules.iim.dao.MailDao
;
import
com.jeespring.modules.iim.entity.Mail
;
import
com.jeespring.modules.iim.entity.MailBox
;
import
com.jeespring.modules.iim.entity.MailCompose
;
/**
* 发件箱Service
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
MailService
extends
AbstractBaseService
<
MailDao
,
Mail
>
{
@Autowired
private
MailBoxDao
mailBoxDao
;
@Autowired
private
MailComposeDao
mailComposeDao
;
public
Mail
get
(
String
id
)
{
Mail
mail
=
super
.
get
(
id
);
mail
.
setMailBoxList
(
mailBoxDao
.
findList
(
new
MailBox
(
mail
)));
mail
.
setMailComposeList
(
mailComposeDao
.
findList
(
new
MailCompose
(
mail
)));
return
mail
;
}
public
List
<
Mail
>
findList
(
Mail
mail
)
{
return
super
.
findList
(
mail
);
}
public
Page
<
Mail
>
findPage
(
Page
<
Mail
>
page
,
Mail
mail
)
{
return
super
.
findPage
(
page
,
mail
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
Mail
mail
)
{
super
.
save
(
mail
);
for
(
MailBox
mailBox
:
mail
.
getMailBoxList
()){
if
(
mailBox
.
getId
()
==
null
){
continue
;
}
if
(
MailBox
.
DEL_FLAG_NORMAL
.
equals
(
mailBox
.
getDelFlag
())){
if
(
StringUtils
.
isBlank
(
mailBox
.
getId
())){
mailBox
.
setMail
(
mail
);
mailBox
.
preInsert
();
mailBoxDao
.
insert
(
mailBox
);
}
else
{
mailBox
.
preUpdate
();
mailBoxDao
.
update
(
mailBox
);
}
}
else
{
mailBoxDao
.
delete
(
mailBox
);
}
}
for
(
MailCompose
mailCompose
:
mail
.
getMailComposeList
()){
if
(
mailCompose
.
getId
()
==
null
){
continue
;
}
if
(
MailCompose
.
DEL_FLAG_NORMAL
.
equals
(
mailCompose
.
getDelFlag
())){
if
(
StringUtils
.
isBlank
(
mailCompose
.
getId
())){
mailCompose
.
setMail
(
mail
);
mailCompose
.
preInsert
();
mailComposeDao
.
insert
(
mailCompose
);
}
else
{
mailCompose
.
preUpdate
();
mailComposeDao
.
update
(
mailCompose
);
}
}
else
{
mailComposeDao
.
delete
(
mailCompose
);
}
}
}
@Transactional
(
readOnly
=
false
)
public
void
saveOnlyMain
(
Mail
mail
)
{
super
.
save
(
mail
);
for
(
MailBox
mailBox
:
mail
.
getMailBoxList
()){
if
(
mailBox
.
getId
()
==
null
){
continue
;
}
if
(
MailBox
.
DEL_FLAG_NORMAL
.
equals
(
mailBox
.
getDelFlag
())){
if
(
StringUtils
.
isBlank
(
mailBox
.
getId
())){
mailBox
.
setMail
(
mail
);
mailBox
.
preInsert
();
mailBoxDao
.
insert
(
mailBox
);
}
else
{
mailBox
.
preUpdate
();
mailBoxDao
.
update
(
mailBox
);
}
}
else
{
mailBoxDao
.
delete
(
mailBox
);
}
}
for
(
MailCompose
mailCompose
:
mail
.
getMailComposeList
()){
if
(
mailCompose
.
getId
()
==
null
){
continue
;
}
if
(
MailCompose
.
DEL_FLAG_NORMAL
.
equals
(
mailCompose
.
getDelFlag
())){
if
(
StringUtils
.
isBlank
(
mailCompose
.
getId
())){
mailCompose
.
setMail
(
mail
);
mailCompose
.
preInsert
();
mailComposeDao
.
insert
(
mailCompose
);
}
else
{
mailCompose
.
preUpdate
();
mailComposeDao
.
update
(
mailCompose
);
}
}
else
{
mailComposeDao
.
delete
(
mailCompose
);
}
}
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
Mail
mail
)
{
super
.
delete
(
mail
);
mailBoxDao
.
delete
(
new
MailBox
(
mail
));
mailComposeDao
.
delete
(
new
MailCompose
(
mail
));
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/service/MyCalendarService.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com.jeespring.modules.iim.service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.modules.iim.dao.MyCalendarDao
;
import
com.jeespring.modules.iim.entity.MyCalendar
;
/**
* 日历Service
* @author liugf
* @version 2016-04-19
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
MyCalendarService
extends
AbstractBaseService
<
MyCalendarDao
,
MyCalendar
>
{
public
MyCalendar
get
(
String
id
)
{
return
super
.
get
(
id
);
}
public
List
<
MyCalendar
>
findList
(
MyCalendar
myCalendar
)
{
return
super
.
findList
(
myCalendar
);
}
public
Page
<
MyCalendar
>
findPage
(
Page
<
MyCalendar
>
page
,
MyCalendar
myCalendar
)
{
return
super
.
findPage
(
page
,
myCalendar
);
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
MyCalendar
myCalendar
)
{
super
.
save
(
myCalendar
);
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
MyCalendar
myCalendar
)
{
super
.
delete
(
myCalendar
);
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/utils/DateUtil.java
deleted
100644 → 0
View file @
51016ad9
package
com.jeespring.modules.iim.utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 日期及时间处理函数
*
* @author liugf
*/
public
class
DateUtil
{
private
static
final
String
DEFAULT_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
/**
* 字符串时间转LONG
* @param sdate
* @return
*/
public
static
long
string2long
(
String
sdate
){
if
(
sdate
.
length
()
<
11
){
sdate
=
sdate
+
" 00:00:00"
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DEFAULT_PATTERN
);
Date
dt2
=
null
;
try
{
dt2
=
sdf
.
parse
(
sdate
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
//继续转换得到秒数的long型
long
lTime
=
dt2
.
getTime
()
/
1000
;
return
lTime
;
}
/**
* LONG时间转字符串
* @param ldate
* @return
*/
public
static
String
long2string
(
long
ldate
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DEFAULT_PATTERN
);
//前面的ldate是秒数,先乘1000得到毫秒数,再转为java.util.Date类型
Date
dt
=
new
Date
(
ldate
*
1000
);
String
sDateTime
=
sdf
.
format
(
dt
);
//得到精确到秒的表示
if
(
sDateTime
.
endsWith
(
"00:00:00"
)){
sDateTime
=
sDateTime
.
substring
(
0
,
10
);
}
return
sDateTime
;
}
}
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/ChatHistoryController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.web
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.json.AjaxJson
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.ChatHistory
;
import
com.jeespring.modules.iim.service.ChatHistoryService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
/**
* 聊天记录Controller
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-12-29
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/chatHistory"
)
public
class
ChatHistoryController
extends
AbstractBaseController
{
@Autowired
private
ChatHistoryService
chatHistoryService
;
@ModelAttribute
public
ChatHistory
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
ChatHistory
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
chatHistoryService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
ChatHistory
();
}
return
entity
;
}
/**
* 聊天列表页面
*/
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
ChatHistory
chatHistory
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
pg
=
new
Page
<
ChatHistory
>(
request
,
response
);
Page
<
ChatHistory
>
page
=
chatHistoryService
.
findPage
(
pg
,
chatHistory
);
model
.
addAttribute
(
"chatHistory"
,
chatHistory
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/iim/chatHistoryList"
;
}
/**
* 查看,增加,编辑聊天表单页面
*/
@RequestMapping
(
value
=
"form"
)
public
String
form
(
ChatHistory
chatHistory
,
Model
model
)
{
model
.
addAttribute
(
"chatHistory"
,
chatHistory
);
return
"modules/iim/chatHistoryForm"
;
}
/**
* 保存聊天
*/
@RequestMapping
(
value
=
"save"
)
public
String
save
(
ChatHistory
chatHistory
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
chatHistory
)){
return
form
(
chatHistory
,
model
);
}
chatHistoryService
.
save
(
chatHistory
);
addMessage
(
redirectAttributes
,
"保存聊天成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/chatHistory/?repage"
;
}
/**
* 删除聊天
*/
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
ChatHistory
chatHistory
,
RedirectAttributes
redirectAttributes
)
{
chatHistoryService
.
delete
(
chatHistory
);
addMessage
(
redirectAttributes
,
"删除聊天成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/chatHistory/?repage"
;
}
/**
* 批量删除聊天
*/
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
chatHistoryService
.
delete
(
chatHistoryService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除聊天成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/chatHistory/?repage"
;
}
/**
* 导出excel文件
*/
@RequiresPermissions
(
"iim:chatHistory:view"
)
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
POST
)
public
String
exportFile
(
ChatHistory
chatHistory
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"聊天"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)+
".xlsx"
;
Page
<
ChatHistory
>
page
=
chatHistoryService
.
findPage
(
new
Page
<
ChatHistory
>(
request
,
response
,
-
1
),
chatHistory
);
new
ExportExcel
(
"聊天"
,
ChatHistory
.
class
).
setDataList
(
page
.
getList
()).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导出聊天记录失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/chatHistory/?repage"
;
}
/**
* 获取聊天记录
*/
@ResponseBody
@RequestMapping
(
value
=
"getChats"
)
public
AjaxJson
getChats
(
ChatHistory
chatHistory
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
ChatHistory
>
page
=
chatHistoryService
.
findPage
(
new
Page
<
ChatHistory
>(
request
,
response
),
chatHistory
);
List
<
ChatHistory
>
list
=
page
.
getList
();
for
(
ChatHistory
c
:
list
){
if
(
c
.
getStatus
().
equals
(
"0"
)){
if
(
c
.
getUserid2
().
equals
(
UserUtils
.
getUser
().
getLoginName
())){
//把发送给我的信息标记为已读
c
.
setStatus
(
"1"
);
//标记为已读
chatHistoryService
.
save
(
c
);
}
}
}
AjaxJson
j
=
new
AjaxJson
();
j
.
setMsg
(
"获取聊天记录成功!"
);
j
.
put
(
"data"
,
page
.
getList
());
return
j
;
}
/**
* 获取未读条数
*/
@ResponseBody
@RequestMapping
(
value
=
"findUnReadCount"
)
public
AjaxJson
findUnReadCount
(
ChatHistory
chatHistory
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
AjaxJson
j
=
new
AjaxJson
();
int
size
=
chatHistoryService
.
findUnReadCount
(
chatHistory
);
j
.
setMsg
(
"获取未读条数成功!"
);
j
.
put
(
"num"
,
size
);
return
j
;
}
/**
* 发送聊天内容(手机端)
*/
@ResponseBody
@RequestMapping
(
value
=
"sendChats"
)
public
AjaxJson
sendChats
(
ChatHistory
chatHistory
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
AjaxJson
j
=
new
AjaxJson
();
j
.
setMsg
(
"消息发送成功!"
);
chatHistory
.
setStatus
(
"0"
);
//标记未读
chatHistoryService
.
save
(
chatHistory
);
return
j
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/ContactController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.web
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.IdGen
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.Friend
;
import
com.jeespring.modules.iim.entity.Group
;
import
com.jeespring.modules.iim.entity.LayJson
;
import
com.jeespring.modules.sys.dao.UserDao
;
import
com.jeespring.modules.sys.entity.Office
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.OfficeService
;
import
com.jeespring.modules.sys.service.SystemService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
/**
* 心电图实时显示查看Controller
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-09
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/contact"
)
public
class
ContactController
extends
AbstractBaseController
{
@Autowired
private
SystemService
systemService
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
OfficeService
officeService
;
/**
* 打开通讯录
* @param user
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping
(
value
=
{
"index"
,
""
})
public
String
index
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
List
<
User
>
list
=
systemService
.
findUser
(
user
);
model
.
addAttribute
(
"list"
,
list
);
return
"modules/iim/contacts"
;
}
/**
* 查找医生
* @param user
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping
(
value
=
"searchUsers"
)
public
String
searchUsers
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
List
<
User
>
friends
=
userDao
.
searchUsers
(
user
);
model
.
addAttribute
(
"list"
,
friends
);
return
"modules/iim/search_user"
;
}
/**
* 添加好友--->常用联系人
*/
@RequestMapping
(
value
=
"addFriend"
)
public
String
addFriend
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
User
currentUser
=
UserUtils
.
getUser
();
for
(
String
id
:
idArray
){
if
(
userDao
.
findFriend
(
currentUser
.
getId
(),
id
)
==
null
){
userDao
.
insertFriend
(
IdGen
.
uuid
(),
currentUser
.
getId
(),
id
);
//添加对方为好友
// userDao.insertFriend(IdGen.uuid(), id, currentUser.getId());//同时把自己添加为对方的好友
}
}
addMessage
(
redirectAttributes
,
"添加好友成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/contact/myFriends/?repage"
;
}
/**
* 删除好友
*/
@RequestMapping
(
value
=
"delFriend"
)
public
String
delFriend
(
String
id
,
RedirectAttributes
redirectAttributes
)
{
User
friend
=
UserUtils
.
get
(
id
);
User
currentUser
=
UserUtils
.
getUser
();
if
(
friend
!=
null
&&
userDao
.
findFriend
(
currentUser
.
getId
(),
friend
.
getId
())
!=
null
){
userDao
.
deleteFriend
(
currentUser
.
getId
(),
friend
.
getId
());
//删除好友
// userDao.deleteFriend(friend.getId(), currentUser.getId());//同时把自己从对方的好友列表删除
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/contact/myFriends/?repage"
;
}
/**
* 打开我的好友列表--->常用联系人列表
* @param user
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping
(
value
=
"myFriends"
)
public
String
myFriends
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
User
currentUser
=
UserUtils
.
getUser
();
List
<
User
>
friends
=
userDao
.
findFriends
(
currentUser
);
model
.
addAttribute
(
"list"
,
friends
);
return
"modules/iim/myFriends"
;
}
/**
* 打开聊天窗口
* @param user
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping
(
value
=
"layerIM"
)
public
String
layerIM
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
List
<
User
>
list
=
systemService
.
findUser
(
user
);
model
.
addAttribute
(
"list"
,
list
);
return
"modules/iim/layerIM"
;
}
@RequestMapping
(
value
=
"friend"
)
@ResponseBody
public
LayJson
getFriend
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
){
LayJson
j
=
new
LayJson
();
j
.
setStatus
(
1
);
//我的好友--->常用联系人
User
currentUser
=
UserUtils
.
getUser
();
List
<
User
>
friends
=
userDao
.
findFriends
(
currentUser
);
Group
friendGroup
=
new
Group
();
friendGroup
.
setName
(
"我的好友"
);
friendGroup
.
setId
(
1
);
friendGroup
.
setNums
(
friends
.
size
());
for
(
User
u
:
friends
){
Friend
friend
=
new
Friend
();
friend
.
setId
(
u
.
getLoginName
());
friend
.
setName
(
u
.
getName
());
friend
.
setFace
(
u
.
getPhoto
());
friendGroup
.
getItem
().
add
(
friend
);
}
j
.
getData
().
add
(
friendGroup
);
List
<
Office
>
officeList
=
officeService
.
findList
(
true
);
int
index
=
1
;
for
(
Office
office
:
officeList
){
user
.
setOffice
(
office
);
List
<
User
>
users
=
userDao
.
findListByOffice
(
user
);
Group
group
=
new
Group
();
group
.
setName
(
office
.
getName
());
group
.
setNums
(
users
.
size
());
group
.
setId
(++
index
);
for
(
User
u
:
users
){
Friend
friend
=
new
Friend
();
friend
.
setId
(
u
.
getLoginName
());
friend
.
setName
(
u
.
getName
());
friend
.
setFace
(
u
.
getPhoto
());
group
.
getItem
().
add
(
friend
);
}
j
.
getData
().
add
(
group
);
}
user
.
setOffice
(
null
);
List
<
User
>
users
=
userDao
.
findListByOffice
(
user
);
Group
group
=
new
Group
();
group
.
setName
(
"未分组"
);
group
.
setNums
(
users
.
size
());
group
.
setId
(++
index
);
for
(
User
u
:
users
){
Friend
friend
=
new
Friend
();
friend
.
setId
(
u
.
getLoginName
());
friend
.
setName
(
u
.
getName
());
friend
.
setFace
(
u
.
getPhoto
());
group
.
getItem
().
add
(
friend
);
}
j
.
getData
().
add
(
group
);
return
j
;
}
/**
* 群组列表接口 预留待开发
* @return
*/
@RequestMapping
(
value
=
"group"
)
@ResponseBody
public
LayJson
getGroup
(){
LayJson
j
=
new
LayJson
();
j
.
setStatus
(
1
);
return
j
;
}
/**
* 最近联系人接口 预留
* @return
*/
@RequestMapping
(
value
=
"chatLog"
)
@ResponseBody
public
LayJson
getChatLog
(){
LayJson
j
=
new
LayJson
();
j
.
setStatus
(
1
);
return
j
;
}
/**
* 群组成员接口 预留
* @return
*/
@RequestMapping
(
value
=
"groups"
)
@ResponseBody
public
LayJson
getGroups
(){
LayJson
j
=
new
LayJson
();
j
.
setStatus
(
1
);
return
j
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/MailBoxController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.web
;
import
java.util.Date
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.MailBox
;
import
com.jeespring.modules.iim.entity.MailCompose
;
import
com.jeespring.modules.iim.entity.MailPage
;
import
com.jeespring.modules.iim.service.MailBoxService
;
import
com.jeespring.modules.iim.service.MailComposeService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
/**
* 收件箱Controller
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-11-13
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/mailBox"
)
public
class
MailBoxController
extends
AbstractBaseController
{
@Autowired
private
MailComposeService
mailComposeService
;
@Autowired
private
MailBoxService
mailBoxService
;
@ModelAttribute
public
MailBox
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
MailBox
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
mailBoxService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
MailBox
();
}
return
entity
;
}
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
MailBox
mailBox
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
mailBox
.
setReceiver
(
UserUtils
.
getUser
());
Page
<
MailBox
>
page
=
mailBoxService
.
findPage
(
new
MailPage
<
MailBox
>(
request
,
response
),
mailBox
);
model
.
addAttribute
(
"page"
,
page
);
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
return
"modules/iim/mailBoxList"
;
}
@RequestMapping
(
value
=
"detail"
)
public
String
detail
(
MailBox
mailBox
,
Model
model
)
{
if
(
mailBox
.
getReadstatus
().
equals
(
"0"
)){
//更改未读状态为已读状态
mailBox
.
setReadstatus
(
"1"
);
//1表示已读
mailBoxService
.
save
(
mailBox
);
}
model
.
addAttribute
(
"mailBox"
,
mailBox
);
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
return
"modules/iim/mailBoxDetail"
;
}
@RequestMapping
(
value
=
"save"
)
public
String
save
(
MailBox
mailBox
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
mailBox
)){
return
detail
(
mailBox
,
model
);
}
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
mailBox
.
setSender
(
UserUtils
.
getUser
());
mailBox
.
setSendtime
(
date
);
mailBoxService
.
save
(
mailBox
);
addMessage
(
redirectAttributes
,
"保存站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailBox/?repage"
;
}
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
MailBox
mailBox
,
RedirectAttributes
redirectAttributes
)
{
mailBoxService
.
delete
(
mailBox
);
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailBox/?repage"
;
}
/**
* 批量删除
*/
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
mailBoxService
.
delete
(
mailBoxService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailBox/?repage"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/MailComposeController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.web
;
import
java.util.Date
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.MailBox
;
import
com.jeespring.modules.iim.entity.MailCompose
;
import
com.jeespring.modules.iim.entity.MailPage
;
import
com.jeespring.modules.iim.service.MailBoxService
;
import
com.jeespring.modules.iim.service.MailComposeService
;
import
com.jeespring.modules.iim.service.MailService
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.SystemService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
/**
* 发件箱Controller
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-13
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/mailCompose"
)
public
class
MailComposeController
extends
AbstractBaseController
{
@Autowired
private
MailComposeService
mailComposeService
;
@Autowired
private
MailBoxService
mailBoxService
;
@Autowired
private
SystemService
systemService
;
@Autowired
private
MailService
mailService
;
@ModelAttribute
public
MailCompose
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
MailCompose
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
mailComposeService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
MailCompose
();
}
return
entity
;
}
/*
* 写站内信
*/
@RequestMapping
(
value
=
{
"sendLetter"
})
public
String
sendLetter
(
User
user
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
user
=
systemService
.
getUser
(
user
.
getId
());
model
.
addAttribute
(
"receiver"
,
user
);
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
return
"modules/iim/mail_send"
;
}
/*
* 回复站内信
*/
@RequestMapping
(
value
=
{
"replyLetter"
})
public
String
replyLetter
(
MailBox
mailBox
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
model
.
addAttribute
(
"mailBox"
,
mailBoxService
.
get
(
mailBox
.
getId
()));
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
return
"modules/iim/mail_reply"
;
}
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
MailCompose
mailCompose
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
MailCompose
>
page
=
mailComposeService
.
findPage
(
new
MailPage
<
MailCompose
>(
request
,
response
),
mailCompose
);
model
.
addAttribute
(
"page"
,
page
);
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
if
(
mailCompose
.
getStatus
()==
null
||
mailCompose
.
getStatus
().
equals
(
"0"
)){
return
"modules/iim/mailDraftList"
;
//草稿箱
}
return
"modules/iim/mailComposeList"
;
//已发送
}
@RequestMapping
(
value
=
"detail"
)
//打开已发送信件
public
String
detail
(
MailCompose
mailCompose
,
Model
model
)
{
model
.
addAttribute
(
"mailCompose"
,
mailCompose
);
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
return
"modules/iim/mailComposeDetail"
;
}
@RequestMapping
(
value
=
"draftDetail"
)
//打开草稿
public
String
draftDetail
(
MailCompose
mailCompose
,
Model
model
)
{
//查询未读的条数
MailBox
serachBox
=
new
MailBox
();
serachBox
.
setReadstatus
(
"0"
);
serachBox
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"noReadCount"
,
mailBoxService
.
getCount
(
serachBox
));
//查询总条数
MailBox
serachBox2
=
new
MailBox
();
serachBox2
.
setReceiver
(
UserUtils
.
getUser
());
model
.
addAttribute
(
"mailBoxCount"
,
mailBoxService
.
getCount
(
serachBox2
));
//查询已发送条数
MailCompose
serachBox3
=
new
MailCompose
();
serachBox3
.
setSender
(
UserUtils
.
getUser
());
serachBox3
.
setStatus
(
"1"
);
//已发送
model
.
addAttribute
(
"mailComposeCount"
,
mailComposeService
.
getCount
(
serachBox3
));
//查询草稿箱条数
MailCompose
serachBox4
=
new
MailCompose
();
serachBox4
.
setSender
(
UserUtils
.
getUser
());
serachBox4
.
setStatus
(
"0"
);
//草稿
model
.
addAttribute
(
"mailDraftCount"
,
mailComposeService
.
getCount
(
serachBox4
));
mailCompose
=
mailComposeService
.
get
(
mailCompose
.
getId
());
model
.
addAttribute
(
"mailCompose"
,
mailCompose
);
return
"modules/iim/mailDraftDetail"
;
}
@RequestMapping
(
value
=
"save"
)
public
String
save
(
MailCompose
mailCompose
,
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
if
(!
beanValidator
(
model
,
mailCompose
.
getMail
())){
return
detail
(
mailCompose
,
model
);
}
mailService
.
saveOnlyMain
(
mailCompose
.
getMail
());
Date
date
=
new
Date
(
System
.
currentTimeMillis
());
mailCompose
.
setSender
(
UserUtils
.
getUser
());
mailCompose
.
setSendtime
(
date
);
for
(
User
receiver
:
mailCompose
.
getReceiverList
()){
mailCompose
.
setReceiver
(
receiver
);
mailCompose
.
setId
(
null
);
//标记为新纪录,每次往发件箱插入一条记录
mailComposeService
.
save
(
mailCompose
);
//0 显示在草稿箱,1 显示在已发送需同时保存到收信人的收件箱。
if
(
mailCompose
.
getStatus
().
equals
(
"1"
))
//已发送,同时保存到收信人的收件箱
{
MailBox
mailBox
=
new
MailBox
();
mailBox
.
setReadstatus
(
"0"
);
mailBox
.
setReceiver
(
receiver
);
mailBox
.
setSender
(
UserUtils
.
getUser
());
mailBox
.
setMail
(
mailCompose
.
getMail
());
mailBox
.
setSendtime
(
date
);
mailBoxService
.
save
(
mailBox
);
}
}
request
.
setAttribute
(
"mailCompose"
,
mailCompose
);
return
"modules/iim/mail_compose_success"
;
}
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
MailCompose
mailCompose
,
RedirectAttributes
redirectAttributes
)
{
mailComposeService
.
delete
(
mailCompose
);
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailCompose/?repage&orderBy=sendtime desc&status="
+
mailCompose
.
getStatus
();
}
/**
* 批量删除已发送
*/
@RequestMapping
(
value
=
"deleteAllCompose"
)
public
String
deleteAllCompose
(
String
ids
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
mailComposeService
.
delete
(
mailComposeService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除邮件成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailCompose/?repage&status=1&orderBy=sendtime desc"
;
}
/**
* 批量删除草稿箱
*/
@RequestMapping
(
value
=
"deleteAllDraft"
)
public
String
deleteAllDraft
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
mailComposeService
.
delete
(
mailComposeService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除邮件成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mailCompose/?repage&status=0&orderBy=sendtime desc"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/MailController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.web
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.Mail
;
import
com.jeespring.modules.iim.service.MailService
;
/**
* 发件箱Controller
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/mail"
)
public
class
MailController
extends
AbstractBaseController
{
@Autowired
private
MailService
mailService
;
@ModelAttribute
public
Mail
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
Mail
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
mailService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
Mail
();
}
return
entity
;
}
@RequiresPermissions
(
"iim:mail:view"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
Mail
mail
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
Mail
>
page
=
mailService
.
findPage
(
new
Page
<
Mail
>(
request
,
response
),
mail
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/iim/mailList"
;
}
@RequiresPermissions
(
"iim:mail:view"
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
Mail
mail
,
Model
model
)
{
model
.
addAttribute
(
"mail"
,
mail
);
return
"modules/iim/mailForm"
;
}
@RequestMapping
(
value
=
"save"
)
public
String
save
(
Mail
mail
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
mail
)){
return
form
(
mail
,
model
);
}
mailService
.
save
(
mail
);
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mail/?repage"
;
}
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
Mail
mail
,
RedirectAttributes
redirectAttributes
)
{
mailService
.
delete
(
mail
);
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mail/?repage"
;
}
/**
* 批量删除
*/
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
mailService
.
delete
(
mailService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除站内信成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/iim/mail/?repage"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/iim/web/MyCalendarController.java
deleted
100644 → 0
View file @
51016ad9
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com.jeespring.modules.iim.web
;
import
java.io.IOException
;
import
java.util.List
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.iim.entity.MyCalendar
;
import
com.jeespring.modules.iim.service.MyCalendarService
;
import
com.jeespring.modules.iim.utils.DateUtil
;
import
com.jeespring.modules.sys.utils.UserUtils
;
/**
* 日历Controller
*
* @author liugf
* @version 2016-04-19
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/iim/myCalendar"
)
public
class
MyCalendarController
extends
AbstractBaseController
{
@Autowired
private
MyCalendarService
myCalendarService
;
@ModelAttribute
public
MyCalendar
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
MyCalendar
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
))
{
entity
=
myCalendarService
.
get
(
id
);
}
if
(
entity
==
null
)
{
entity
=
new
MyCalendar
();
}
return
entity
;
}
/**
* 日历页面
*/
@RequestMapping
(
value
=
{
"index"
,
""
})
public
String
index
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
"modules/iim/myCalendar"
;
}
/**
* 查看,增加,编辑日历信息表单页面
*/
@RequestMapping
(
value
=
"addform"
)
public
String
addform
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
String
date
=
request
.
getParameter
(
"date"
);
String
enddate
=
request
.
getParameter
(
"end"
);
if
(
date
.
equals
(
enddate
))
{
enddate
=
""
;
}
String
display
=
""
;
String
chk
=
""
;
if
(
""
.
equals
(
enddate
))
{
display
=
"style=\"display:none\""
;
enddate
=
date
;
}
else
{
chk
=
"checked"
;
}
model
.
addAttribute
(
"date"
,
date
);
model
.
addAttribute
(
"display"
,
display
);
model
.
addAttribute
(
"chk"
,
chk
);
model
.
addAttribute
(
"enddate"
,
enddate
);
model
.
addAttribute
(
"myCalendar"
,
myCalendar
);
return
"modules/iim/myCalendarForm-add"
;
}
@RequestMapping
(
value
=
"editform"
)
public
String
editform
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
String
title
=
myCalendar
.
getTitle
();
// 事件标题
String
start
=
myCalendar
.
getStart
();
// 事件开始时间
String
end
=
myCalendar
.
getEnd
();
// 结束时间
String
allDay
=
myCalendar
.
getAdllDay
();
// 是否为全天事件
String
color
=
myCalendar
.
getColor
();
// 事件的背景
String
start_d
=
""
;
String
start_h
=
""
;
String
start_m
=
""
;
String
end_d
=
""
;
String
end_h
=
""
;
String
end_m
=
""
;
if
(
"1"
.
equals
(
allDay
)
&&
!
""
.
equals
(
end
))
{
start_d
=
start
;
end_d
=
end
;
}
else
if
(
"1"
.
equals
(
allDay
)
&&
""
.
equals
(
end
))
{
start_d
=
start
;
}
else
if
(
"0"
.
equals
(
allDay
)
&&
!
""
.
equals
(
end
))
{
start_d
=
start
.
substring
(
0
,
10
);
start_h
=
start
.
substring
(
11
,
13
);
start_m
=
start
.
substring
(
14
,
16
);
end_d
=
end
.
substring
(
0
,
10
);
end_h
=
end
.
substring
(
11
,
13
);
end_m
=
end
.
substring
(
14
,
16
);
}
else
{
start_d
=
start
.
substring
(
0
,
10
);
start_h
=
start
.
substring
(
11
,
13
);
start_m
=
start
.
substring
(
14
,
16
);
}
model
.
addAttribute
(
"title"
,
title
);
model
.
addAttribute
(
"color"
,
color
);
model
.
addAttribute
(
"start_d"
,
start_d
);
model
.
addAttribute
(
"start_h"
,
start_h
);
model
.
addAttribute
(
"start_m"
,
start_m
);
model
.
addAttribute
(
"end"
,
end_d
);
model
.
addAttribute
(
"end_d"
,
end_d
);
model
.
addAttribute
(
"end_h"
,
end_h
);
model
.
addAttribute
(
"end_m"
,
end_m
);
model
.
addAttribute
(
"allDay"
,
allDay
);
return
"modules/iim/myCalendarForm-edit"
;
}
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"findList"
)
protected
List
<
MyCalendar
>
doPost
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
throws
ServletException
,
IOException
{
myCalendar
.
setUser
(
UserUtils
.
getUser
());
List
<
MyCalendar
>
list
=
myCalendarService
.
findList
(
myCalendar
);
return
list
;
}
/**
* 新建日历
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"add"
)
public
String
add
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
String
events
=
request
.
getParameter
(
"event"
);
// 事件内容
String
isallday
=
request
.
getParameter
(
"isallday"
);
// 是否是全天事件
String
isend
=
request
.
getParameter
(
"isend"
);
// 是否有结束时间
String
startdate
=
request
.
getParameter
(
"startdate"
);
String
enddate
=
request
.
getParameter
(
"enddate"
);
String
s_time
=
request
.
getParameter
(
"s_hour"
)
+
":"
+
request
.
getParameter
(
"s_minute"
)
+
":00"
;
String
e_time
=
request
.
getParameter
(
"e_hour"
)
+
":"
+
request
.
getParameter
(
"e_minute"
)
+
":00"
;
String
start
=
""
;
String
end
=
""
;
if
(
"1"
.
equals
(
isallday
)
&&
"1"
.
equals
(
isend
))
{
start
=
startdate
;
end
=
enddate
;
}
else
if
(
"1"
.
equals
(
isallday
)
&&
isend
==
null
)
{
start
=
startdate
;
}
else
if
(
isallday
==
null
&&
"1"
.
equals
(
isend
))
{
start
=
startdate
+
" "
+
s_time
;
end
=
enddate
+
" "
+
e_time
;
isallday
=
"0"
;
}
else
{
start
=
startdate
+
" "
+
s_time
;
isallday
=
"0"
;
}
String
[]
colors
=
{
"#360"
,
"#f30"
,
"#06c"
};
int
index
=
(
int
)
(
Math
.
random
()
*
colors
.
length
);
myCalendar
.
setTitle
(
events
);
myCalendar
.
setStart
(
start
);
myCalendar
.
setEnd
(
end
);
myCalendar
.
setAdllDay
(
isallday
);
myCalendar
.
setColor
(
colors
[
index
]);
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
return
"1"
;
}
/**
* 编辑日历
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"edit"
)
public
String
edit
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
String
events
=
request
.
getParameter
(
"event"
);
// 事件内容
String
isallday
=
request
.
getParameter
(
"isallday"
);
// 是否是全天事件
String
isend
=
request
.
getParameter
(
"isend"
);
// 是否有结束时间
String
startdate
=
request
.
getParameter
(
"startdate"
);
String
enddate
=
request
.
getParameter
(
"enddate"
);
String
s_time
=
request
.
getParameter
(
"s_hour"
)
+
":"
+
request
.
getParameter
(
"s_minute"
)
+
":00"
;
String
e_time
=
request
.
getParameter
(
"e_hour"
)
+
":"
+
request
.
getParameter
(
"e_minute"
)
+
":00"
;
String
start
=
""
;
String
end
=
""
;
if
(
"1"
.
equals
(
isallday
)
&&
"1"
.
equals
(
isend
))
{
start
=
startdate
;
end
=
enddate
;
}
else
if
(
"1"
.
equals
(
isallday
)
&&
isend
==
null
)
{
start
=
startdate
;
}
else
if
(
isallday
==
null
&&
"1"
.
equals
(
isend
))
{
start
=
startdate
+
" "
+
s_time
;
end
=
enddate
+
" "
+
e_time
;
isallday
=
"0"
;
}
else
{
start
=
startdate
+
" "
+
s_time
;
isallday
=
"0"
;
}
String
[]
colors
=
{
"#360"
,
"#f30"
,
"#06c"
};
int
index
=
(
int
)
(
Math
.
random
()
*
colors
.
length
);
myCalendar
.
setTitle
(
events
);
myCalendar
.
setStart
(
start
);
myCalendar
.
setEnd
(
end
);
myCalendar
.
setAdllDay
(
isallday
);
myCalendar
.
setColor
(
colors
[
index
]);
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
model
.
addAttribute
(
"myCalendar"
,
myCalendar
);
return
"1"
;
}
/**
* 删除日历
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"del"
)
public
String
del
(
MyCalendar
myCalendar
,
RedirectAttributes
redirectAttributes
)
{
myCalendarService
.
delete
(
myCalendar
);
return
"1"
;
}
/**
* 縮放日歷
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"resize"
)
public
String
resize
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Integer
daydiff
=
Integer
.
parseInt
(
request
.
getParameter
(
"daydiff"
))
*
24
*
60
*
60
;
Integer
minudiff
=
Integer
.
parseInt
(
request
.
getParameter
(
"minudiff"
))
*
60
;
String
start
=
myCalendar
.
getStart
();
long
lstart
=
DateUtil
.
string2long
(
start
);
String
end
=
myCalendar
.
getEnd
();
Integer
difftime
=
daydiff
+
minudiff
;
if
(
""
.
equals
(
end
))
{
myCalendar
.
setEnd
(
DateUtil
.
long2string
(
lstart
+
difftime
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
else
{
long
lend
=
DateUtil
.
string2long
(
end
);
myCalendar
.
setEnd
(
DateUtil
.
long2string
(
lend
+
difftime
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
return
"1"
;
}
/**
* 拖拽日历
*/
@RequiresPermissions
(
"user"
)
@ResponseBody
@RequestMapping
(
value
=
"drag"
)
public
String
drag
(
MyCalendar
myCalendar
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Integer
daydiff
=
Integer
.
parseInt
(
request
.
getParameter
(
"daydiff"
))
*
24
*
60
*
60
;
Integer
minudiff
=
Integer
.
parseInt
(
request
.
getParameter
(
"minudiff"
))
*
60
;
String
allday
=
request
.
getParameter
(
"allday"
);
String
start
=
myCalendar
.
getStart
();
long
lstart
=
DateUtil
.
string2long
(
start
);
String
end
=
myCalendar
.
getEnd
();
if
(
"true"
.
equals
(
allday
))
{
if
(
""
.
equals
(
end
))
{
myCalendar
.
setStart
(
DateUtil
.
long2string
(
lstart
+
daydiff
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
else
{
long
lend
=
DateUtil
.
string2long
(
end
);
myCalendar
.
setStart
(
DateUtil
.
long2string
(
lstart
+
daydiff
));
myCalendar
.
setEnd
(
DateUtil
.
long2string
(
lend
+
daydiff
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
}
else
{
Integer
difftime
=
daydiff
+
minudiff
;
if
(
""
.
equals
(
end
))
{
myCalendar
.
setStart
(
DateUtil
.
long2string
(
lstart
+
difftime
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
else
{
long
lend
=
DateUtil
.
string2long
(
end
);
myCalendar
.
setStart
(
DateUtil
.
long2string
(
lstart
+
difftime
));
myCalendar
.
setEnd
(
DateUtil
.
long2string
(
lend
+
difftime
));
myCalendar
.
setUser
(
UserUtils
.
getUser
());
myCalendarService
.
save
(
myCalendar
);
}
}
return
"1"
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/dao/SysJobDao.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.job.entity.SysJob
;
/**
* 定时任务调度DAO接口
* @author JeeSpring
* @version 2018-08-16
*/
@Mapper
public
interface
SysJobDao
extends
InterfaceBaseDao
<
SysJob
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/dao/SysJobLogDao.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.job.entity.SysJobLog
;
/**
* 定时任务调度日志表DAO接口
* @author JeeSpring
* @version 2018-08-16
*/
@Mapper
public
interface
SysJobLogDao
extends
InterfaceBaseDao
<
SysJobLog
>
{
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/entity/SysJob.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.entity
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
import
com.jeespring.modules.sys.utils.DictUtils
;
/**
* 定时任务调度Entity
* @author JeeSpring
* @version 2018-08-16
*/
public
class
SysJob
extends
AbstractBaseEntity
<
SysJob
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
jobName
;
// 任务名称
private
String
jobGroup
;
// 任务组名
private
String
methodName
;
// 任务方法
private
String
methodParams
;
// 方法参数
private
String
cronExpression
;
// cron执行表达式
private
String
misfirePolicy
;
// 计划执行错误策略(0默认 1继续 2等待 3放弃)
private
String
misfirePolicyLabel
;
// 计划执行错误策略(0默认 1继续 2等待 3放弃)Label
private
String
misfirePolicyPicture
;
// 计划执行错误策略(0默认 1继续 2等待 3放弃)Picture
private
String
status
;
// 状态(0正常 1暂停)
private
String
statusLabel
;
// 状态(0正常 1暂停)Label
private
String
statusPicture
;
// 状态(0正常 1暂停)Picture
private
String
remark
;
// 备注信息
private
java
.
util
.
Date
beginCreateDate
;
// 开始 创建时间
private
java
.
util
.
Date
endCreateDate
;
// 结束 创建时间
private
java
.
util
.
Date
beginUpdateDate
;
// 开始 更新时间
private
java
.
util
.
Date
endUpdateDate
;
// 结束 更新时间
public
SysJob
()
{
super
();
}
public
SysJob
(
String
id
){
super
(
id
);
}
@Length
(
min
=
1
,
max
=
64
,
message
=
"任务名称长度必须介于 1 和 64 之间"
)
@ExcelField
(
title
=
"任务名称"
,
align
=
2
,
sort
=
1
)
public
String
getJobName
()
{
return
jobName
;
}
public
void
setJobName
(
String
jobName
)
{
this
.
jobName
=
jobName
;
}
@Length
(
min
=
1
,
max
=
64
,
message
=
"任务组名长度必须介于 1 和 64 之间"
)
@ExcelField
(
title
=
"任务组名"
,
align
=
2
,
sort
=
2
)
public
String
getJobGroup
()
{
return
jobGroup
;
}
public
void
setJobGroup
(
String
jobGroup
)
{
this
.
jobGroup
=
jobGroup
;
}
@Length
(
min
=
0
,
max
=
500
,
message
=
"任务方法长度必须介于 0 和 500 之间"
)
@ExcelField
(
title
=
"任务方法"
,
align
=
2
,
sort
=
3
)
public
String
getMethodName
()
{
return
methodName
;
}
public
void
setMethodName
(
String
methodName
)
{
this
.
methodName
=
methodName
;
}
@Length
(
min
=
0
,
max
=
200
,
message
=
"方法参数长度必须介于 0 和 200 之间"
)
@ExcelField
(
title
=
"方法参数"
,
align
=
2
,
sort
=
4
)
public
String
getMethodParams
()
{
return
methodParams
;
}
public
void
setMethodParams
(
String
methodParams
)
{
this
.
methodParams
=
methodParams
;
}
@Length
(
min
=
0
,
max
=
255
,
message
=
"cron执行表达式长度必须介于 0 和 255 之间"
)
@ExcelField
(
title
=
"cron执行表达式"
,
align
=
2
,
sort
=
5
)
public
String
getCronExpression
()
{
return
cronExpression
;
}
public
void
setCronExpression
(
String
cronExpression
)
{
this
.
cronExpression
=
cronExpression
;
}
@Length
(
min
=
0
,
max
=
20
,
message
=
"计划执行错误策略(0默认 1继续 2等待 3放弃)长度必须介于 0 和 20 之间"
)
@ExcelField
(
title
=
"计划执行错误策略(0默认 1继续 2等待 3放弃)"
,
align
=
2
,
sort
=
6
)
public
String
getMisfirePolicy
()
{
return
misfirePolicy
;
}
public
void
setMisfirePolicy
(
String
misfirePolicy
)
{
this
.
misfirePolicy
=
misfirePolicy
;
}
@Length
(
min
=
0
,
max
=
1
,
message
=
"状态(0正常 1暂停)长度必须介于 0 和 1 之间"
)
@ExcelField
(
title
=
"状态(0正常 1暂停)"
,
dictType
=
"job_status"
,
align
=
2
,
sort
=
7
)
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatusLabel
()
{
return
DictUtils
.
getDictLabel
(
status
,
"job_status"
,
""
);
}
public
String
getStatusPicture
()
{
return
DictUtils
.
getDictPicture
(
status
,
"job_status"
,
""
);
}
public
String
getMisfirePolicyLabel
()
{
return
DictUtils
.
getDictLabel
(
misfirePolicy
,
"misfire_policy"
,
""
);
}
public
String
getMisfirePolicyPicture
()
{
return
DictUtils
.
getDictPicture
(
misfirePolicy
,
"misfire_policy"
,
""
);
}
@Length
(
min
=
0
,
max
=
500
,
message
=
"备注信息长度必须介于 0 和 500 之间"
)
@ExcelField
(
title
=
"备注信息"
,
align
=
2
,
sort
=
12
)
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
Date
getBeginCreateDate
()
{
return
beginCreateDate
;
}
public
void
setBeginCreateDate
(
Date
beginCreateDate
)
{
this
.
beginCreateDate
=
beginCreateDate
;
}
public
Date
getEndCreateDate
()
{
return
endCreateDate
;
}
public
void
setEndCreateDate
(
Date
endCreateDate
)
{
this
.
endCreateDate
=
endCreateDate
;
}
public
Date
getBeginUpdateDate
()
{
return
beginUpdateDate
;
}
public
void
setBeginUpdateDate
(
Date
beginUpdateDate
)
{
this
.
beginUpdateDate
=
beginUpdateDate
;
}
public
Date
getEndUpdateDate
()
{
return
endUpdateDate
;
}
public
void
setEndUpdateDate
(
Date
endUpdateDate
)
{
this
.
endUpdateDate
=
endUpdateDate
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/entity/SysJobLog.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.entity
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
import
com.jeespring.modules.sys.utils.DictUtils
;
/**
* 定时任务调度日志表Entity
* @author JeeSpring
* @version 2018-08-16
*/
public
class
SysJobLog
extends
AbstractBaseEntity
<
SysJobLog
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
jobName
;
// 任务名称
private
String
jobGroup
;
// 任务组名
private
String
methodName
;
// 任务方法
private
String
methodParams
;
// 方法参数
private
String
jobMessage
;
// 日志信息
private
String
status
;
// 执行状态(0正常 1失败)
private
String
statusLabel
;
// 执行状态(0正常 1失败)Label
private
String
statusPicture
;
// 执行状态(0正常 1失败)Picture
private
String
exceptionInfo
;
// 异常信息
private
java
.
util
.
Date
beginCreateDate
;
// 开始 创建时间
private
java
.
util
.
Date
endCreateDate
;
// 结束 创建时间
public
SysJobLog
()
{
super
();
}
public
SysJobLog
(
String
id
){
super
(
id
);
}
@Length
(
min
=
1
,
max
=
64
,
message
=
"任务名称长度必须介于 1 和 64 之间"
)
@ExcelField
(
title
=
"任务名称"
,
align
=
2
,
sort
=
1
)
public
String
getJobName
()
{
return
jobName
;
}
public
void
setJobName
(
String
jobName
)
{
this
.
jobName
=
jobName
;
}
@Length
(
min
=
1
,
max
=
64
,
message
=
"任务组名长度必须介于 1 和 64 之间"
)
@ExcelField
(
title
=
"任务组名"
,
align
=
2
,
sort
=
2
)
public
String
getJobGroup
()
{
return
jobGroup
;
}
public
void
setJobGroup
(
String
jobGroup
)
{
this
.
jobGroup
=
jobGroup
;
}
@Length
(
min
=
0
,
max
=
500
,
message
=
"任务方法长度必须介于 0 和 500 之间"
)
@ExcelField
(
title
=
"任务方法"
,
align
=
2
,
sort
=
3
)
public
String
getMethodName
()
{
return
methodName
;
}
public
void
setMethodName
(
String
methodName
)
{
this
.
methodName
=
methodName
;
}
@Length
(
min
=
0
,
max
=
200
,
message
=
"方法参数长度必须介于 0 和 200 之间"
)
@ExcelField
(
title
=
"方法参数"
,
align
=
2
,
sort
=
4
)
public
String
getMethodParams
()
{
return
methodParams
;
}
public
void
setMethodParams
(
String
methodParams
)
{
this
.
methodParams
=
methodParams
;
}
@Length
(
min
=
0
,
max
=
500
,
message
=
"日志信息长度必须介于 0 和 500 之间"
)
@ExcelField
(
title
=
"日志信息"
,
align
=
2
,
sort
=
5
)
public
String
getJobMessage
()
{
return
jobMessage
;
}
public
void
setJobMessage
(
String
jobMessage
)
{
this
.
jobMessage
=
jobMessage
;
}
@Length
(
min
=
0
,
max
=
1
,
message
=
"执行状态(0正常 1失败)长度必须介于 0 和 1 之间"
)
@ExcelField
(
title
=
"执行状态(0正常 1失败)"
,
dictType
=
"job_status"
,
align
=
2
,
sort
=
6
)
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatusLabel
()
{
return
DictUtils
.
getDictLabel
(
status
,
"job_status"
,
""
);
}
public
String
getStatusPicture
()
{
return
DictUtils
.
getDictPicture
(
status
,
"job_status"
,
""
);
}
@ExcelField
(
title
=
"异常信息"
,
align
=
2
,
sort
=
7
)
public
String
getExceptionInfo
()
{
return
exceptionInfo
;
}
public
void
setExceptionInfo
(
String
exceptionInfo
)
{
this
.
exceptionInfo
=
exceptionInfo
;
}
public
Date
getBeginCreateDate
()
{
return
beginCreateDate
;
}
public
void
setBeginCreateDate
(
Date
beginCreateDate
)
{
this
.
beginCreateDate
=
beginCreateDate
;
}
public
Date
getEndCreateDate
()
{
return
endCreateDate
;
}
public
void
setEndCreateDate
(
Date
endCreateDate
)
{
this
.
endCreateDate
=
endCreateDate
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/rest/SysJobLogRestController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.rest
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.utils.excel.ImportExcel
;
import
com.jeespring.modules.job.entity.SysJobLog
;
import
com.jeespring.modules.job.service.SysJobLogService
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
/**
* 定时任务调度日志表Controller
* @author JeeSpring
* @version 2018-08-16
*/
@RestController
@RequestMapping
(
value
=
"/rest/job/sysJobLog"
)
@Api
(
value
=
"定时任务调度日志接口"
,
description
=
"定时任务调度日志接口"
)
public
class
SysJobLogRestController
extends
AbstractBaseController
{
@Autowired
private
SysJobLogService
sysJobLogService
;
/**
* 定时任务调度日志信息
*/
@RequestMapping
(
value
=
{
"get"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度日志信息(Content-Type为text/html)"
,
notes
=
"定时任务调度日志信息(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"定时任务调度日志id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
getRequestParam
(
@RequestParam
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
@RequestMapping
(
value
=
{
"get/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度日志信息(Content-Type为application/json)"
,
notes
=
"定时任务调度日志信息(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"定时任务调度日志id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
getRequestBody
(
@RequestBody
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
private
Result
get
(
String
id
)
{
SysJobLog
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
sysJobLogService
.
getCache
(
id
);
//entity = sysJobLogService.get(id);
}
if
(
entity
==
null
){
entity
=
new
SysJobLog
();
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
entity
);
return
result
;
}
/**
* 定时任务调度日志列表(不包含页信息)
*/
//RequiresPermissions("job:sysJobLog:findList")
@RequestMapping
(
value
=
{
"findList"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度日志列表(不包含页信息)(Content-Type为text/html)"
,
notes
=
"定时任务调度日志列表(不包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
findListRequestParam
(
SysJobLog
sysJobLog
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
findList
(
sysJobLog
,
model
);
}
@RequestMapping
(
value
=
{
"findList/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度日志列表(不包含页信息)(Content-Type为application/json)"
,
notes
=
"定时任务调度日志列表(不包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
findListRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
Model
model
)
{
return
findList
(
sysJobLog
,
model
);
}
private
Result
findList
(
SysJobLog
sysJobLog
,
Model
model
)
{
List
<
SysJobLog
>
list
=
sysJobLogService
.
findListCache
(
sysJobLog
);
//List<SysJobLog> list = sysJobLogService.findList(sysJobLog);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
list
);
return
result
;
}
/**
* 定时任务调度日志列表(包含页信息)
*/
//RequiresPermissions("job:sysJobLog:list")
@RequestMapping
(
value
=
{
"list"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度日志列表(包含页信息)(Content-Type为text/html)"
,
notes
=
"定时任务调度日志列表(包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
listRequestParam
(
SysJobLog
sysJobLog
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
list
(
sysJobLog
,
model
);
}
@RequestMapping
(
value
=
{
"list/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度日志列表(包含页信息)(Content-Type为application/json)"
,
notes
=
"定时任务调度日志列表(包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
listRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
Model
model
)
{
return
list
(
sysJobLog
,
model
);
}
private
Result
list
(
SysJobLog
sysJobLog
,
Model
model
)
{
Page
<
SysJobLog
>
page
=
sysJobLogService
.
findPageCache
(
new
Page
<
SysJobLog
>(
sysJobLog
.
getPageNo
(),
sysJobLog
.
getPageSize
(),
sysJobLog
.
getOrderBy
()),
sysJobLog
);
//Page<SysJobLog> page = sysJobLogService.findPage(new Page<SysJobLog>(sysJobLog.getPageNo(),sysJobLog.getPageSize(),sysJobLog.getOrderBy()), sysJobLog);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
page
);
return
result
;
}
/**
* 定时任务调度日志获取列表第一条记录
*/
//RequiresPermissions("job:sysJobLog:listFrist")
@RequestMapping
(
value
=
{
"listFrist"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度日志获取列表第一条记录(Content-Type为text/html)"
,
notes
=
"定时任务调度日志获取列表第一条记录(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
listFristRequestParam
(
SysJobLog
sysJobLog
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
listFrist
(
sysJobLog
,
model
);
}
@RequestMapping
(
value
=
{
"listFrist/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度日志获取列表第一条记录(Content-Type为application/json)"
,
notes
=
"定时任务调度日志获取列表第一条记录(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
listFristRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
Model
model
)
{
return
listFrist
(
sysJobLog
,
model
);
}
private
Result
listFrist
(
SysJobLog
sysJobLog
,
Model
model
)
{
Page
<
SysJobLog
>
page
=
sysJobLogService
.
findPageCache
(
new
Page
<
SysJobLog
>(
sysJobLog
.
getPageNo
(),
sysJobLog
.
getPageSize
(),
sysJobLog
.
getOrderBy
()),
sysJobLog
);
//Page<SysJobLog> page = sysJobLogService.findPage(new Page<SysJobLog>(sysJobLog.getPageNo(),sysJobLog.getPageSize(),sysJobLog.getOrderBy()), sysJobLog);
Result
result
=
ResultFactory
.
getSuccessResult
();
if
(
page
.
getList
().
size
()>
0
){
result
.
setResultObject
(
page
.
getList
().
get
(
0
));
}
else
{
result
=
ResultFactory
.
getErrorResult
(
"没有记录!"
);
}
return
result
;
}
/**
* 保存定时任务调度日志
*/
//RequiresPermissions(value={"job:sysJobLog:add","job:sysJobLog:edit"},logical=Logical.OR)
@RequestMapping
(
value
=
"save"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"保存定时任务调度日志(Content-Type为text/html)"
,
notes
=
"保存定时任务调度日志(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
saveRequestParam
(
SysJobLog
sysJobLog
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
sysJobLog
,
model
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"save/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"保存定时任务调度日志(Content-Type为application/json)"
,
notes
=
"保存定时任务调度日志(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
saveRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
sysJobLog
,
model
,
redirectAttributes
);
}
private
Result
save
(
SysJobLog
sysJobLog
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
sysJobLog
)){
Result
result
=
ResultFactory
.
getErrorResult
(
"数据验证失败"
);
}
sysJobLogService
.
save
(
sysJobLog
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"保存定时任务调度日志成功"
);
return
result
;
}
/**
* 删除定时任务调度日志
*/
//RequiresPermissions("job:sysJobLog:del")
@RequestMapping
(
value
=
"delete"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"删除定时任务调度日志(Content-Type为text/html)"
,
notes
=
"删除定时任务调度日志(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
deleteRequestParam
(
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
sysJobLog
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"delete/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"删除定时任务调度日志(Content-Type为application/json)"
,
notes
=
"删除定时任务调度日志(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
deleteRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
sysJobLog
,
redirectAttributes
);
}
private
Result
delete
(
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
sysJobLogService
.
delete
(
sysJobLog
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度日志成功"
);
return
result
;
}
/**
* 删除定时任务调度日志(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑删除定时任务调度日志(Content-Type为text/html)"
,
notes
=
"逻辑删除定时任务调度日志(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"query"
)
public
Result
deleteByLogicRequestParam
(
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
sysJobLog
,
redirectAttributes
);
}
/**
* 删除定时任务调度日志(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑删除定时任务调度日志(Content-Type为application/json)"
,
notes
=
"逻辑删除定时任务调度日志(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJobLog"
,
value
=
"定时任务调度日志"
,
dataType
=
"SysJobLog"
,
paramType
=
"body"
)
public
Result
deleteByLogicRequestBody
(
@RequestBody
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
sysJobLog
,
redirectAttributes
);
}
private
Result
deleteByLogic
(
SysJobLog
sysJobLog
,
RedirectAttributes
redirectAttributes
)
{
sysJobLogService
.
deleteByLogic
(
sysJobLog
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度日志成功"
);
return
result
;
}
/**
* 批量删除定时任务调度日志
*/
//RequiresPermissions("job:sysJobLog:del")
@RequestMapping
(
value
=
"deleteAll"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"批量删除定时任务调度日志(Content-Type为text/html)"
,
notes
=
"批量删除定时任务调度日志(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度日志ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"deleteAll/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"批量删除定时任务调度日志(Content-Type为application/json)"
,
notes
=
"批量删除定时任务调度日志(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度日志ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
private
Result
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
sysJobLogService
.
delete
(
sysJobLogService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度日志成功"
);
return
result
;
}
/**
* 批量删除定时任务调度日志(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑批量删除定时任务调度日志(Content-Type为text/html)"
,
notes
=
"逻辑批量删除定时任务调度日志(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度日志ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllByLogicRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
/**
* 批量删除定时任务调度日志(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑批量删除定时任务调度日志(Content-Type为application/json)"
,
notes
=
"逻辑批量删除定时任务调度日志(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度日志ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllByLogicRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
private
Result
deleteAllByLogic
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
sysJobLogService
.
deleteByLogic
(
sysJobLogService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度日志成功"
);
return
result
;
}
}
\ No newline at end of file
JeeSpringCloud/src/main/java/com/jeespring/modules/job/rest/SysJobRestController.java
deleted
100644 → 0
View file @
51016ad9
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.job.rest
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.utils.DateUtils
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.utils.excel.ExportExcel
;
import
com.jeespring.common.utils.excel.ImportExcel
;
import
com.jeespring.modules.job.entity.SysJob
;
import
com.jeespring.modules.job.service.SysJobService
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
/**
* 定时任务调度Controller
* @author JeeSpring
* @version 2018-08-16
*/
@RestController
@RequestMapping
(
value
=
"/rest/job/sysJob"
)
@Api
(
value
=
"定时任务调度接口"
,
description
=
"定时任务调度接口"
)
public
class
SysJobRestController
extends
AbstractBaseController
{
@Autowired
private
SysJobService
sysJobService
;
/**
* 定时任务调度信息
*/
@RequestMapping
(
value
=
{
"get"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度信息(Content-Type为text/html)"
,
notes
=
"定时任务调度信息(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"定时任务调度id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
getRequestParam
(
@RequestParam
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
@RequestMapping
(
value
=
{
"get/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度信息(Content-Type为application/json)"
,
notes
=
"定时任务调度信息(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"定时任务调度id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
getRequestBody
(
@RequestBody
(
required
=
false
)
String
id
)
{
return
get
(
id
);
}
private
Result
get
(
String
id
)
{
SysJob
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
sysJobService
.
getCache
(
id
);
//entity = sysJobService.get(id);
}
if
(
entity
==
null
){
entity
=
new
SysJob
();
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
entity
);
return
result
;
}
/**
* 定时任务调度列表(不包含页信息)
*/
//RequiresPermissions("job:sysJob:findList")
@RequestMapping
(
value
=
{
"findList"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度列表(不包含页信息)(Content-Type为text/html)"
,
notes
=
"定时任务调度列表(不包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
findListRequestParam
(
SysJob
sysJob
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
findList
(
sysJob
,
model
);
}
@RequestMapping
(
value
=
{
"findList/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度列表(不包含页信息)(Content-Type为application/json)"
,
notes
=
"定时任务调度列表(不包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
findListRequestBody
(
@RequestBody
SysJob
sysJob
,
Model
model
)
{
return
findList
(
sysJob
,
model
);
}
private
Result
findList
(
SysJob
sysJob
,
Model
model
)
{
List
<
SysJob
>
list
=
sysJobService
.
findListCache
(
sysJob
);
//List<SysJob> list = sysJobService.findList(sysJob);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
list
);
return
result
;
}
/**
* 定时任务调度列表(包含页信息)
*/
//RequiresPermissions("job:sysJob:list")
@RequestMapping
(
value
=
{
"list"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度列表(包含页信息)(Content-Type为text/html)"
,
notes
=
"定时任务调度列表(包含页信息)(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
listRequestParam
(
SysJob
sysJob
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
list
(
sysJob
,
model
);
}
@RequestMapping
(
value
=
{
"list/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度列表(包含页信息)(Content-Type为application/json)"
,
notes
=
"定时任务调度列表(包含页信息)(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
listRequestBody
(
@RequestBody
SysJob
sysJob
,
Model
model
)
{
return
list
(
sysJob
,
model
);
}
private
Result
list
(
SysJob
sysJob
,
Model
model
)
{
Page
<
SysJob
>
page
=
sysJobService
.
findPageCache
(
new
Page
<
SysJob
>(
sysJob
.
getPageNo
(),
sysJob
.
getPageSize
(),
sysJob
.
getOrderBy
()),
sysJob
);
//Page<SysJob> page = sysJobService.findPage(new Page<SysJob>(sysJob.getPageNo(),sysJob.getPageSize(),sysJob.getOrderBy()), sysJob);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
page
);
return
result
;
}
/**
* 定时任务调度获取列表第一条记录
*/
//RequiresPermissions("job:sysJob:listFrist")
@RequestMapping
(
value
=
{
"listFrist"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"定时任务调度获取列表第一条记录(Content-Type为text/html)"
,
notes
=
"定时任务调度获取列表第一条记录(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
listFristRequestParam
(
SysJob
sysJob
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
listFrist
(
sysJob
,
model
);
}
@RequestMapping
(
value
=
{
"listFrist/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"定时任务调度获取列表第一条记录(Content-Type为application/json)"
,
notes
=
"定时任务调度获取列表第一条记录(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
listFristRequestBody
(
@RequestBody
SysJob
sysJob
,
Model
model
)
{
return
listFrist
(
sysJob
,
model
);
}
private
Result
listFrist
(
SysJob
sysJob
,
Model
model
)
{
Page
<
SysJob
>
page
=
sysJobService
.
findPageCache
(
new
Page
<
SysJob
>(
sysJob
.
getPageNo
(),
sysJob
.
getPageSize
(),
sysJob
.
getOrderBy
()),
sysJob
);
//Page<SysJob> page = sysJobService.findPage(new Page<SysJob>(sysJob.getPageNo(),sysJob.getPageSize(),sysJob.getOrderBy()), sysJob);
Result
result
=
ResultFactory
.
getSuccessResult
();
if
(
page
.
getList
().
size
()>
0
){
result
.
setResultObject
(
page
.
getList
().
get
(
0
));
}
else
{
result
=
ResultFactory
.
getErrorResult
(
"没有记录!"
);
}
return
result
;
}
/**
* 保存定时任务调度
*/
//RequiresPermissions(value={"job:sysJob:add","job:sysJob:edit"},logical=Logical.OR)
@RequestMapping
(
value
=
"save"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"保存定时任务调度(Content-Type为text/html)"
,
notes
=
"保存定时任务调度(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
saveRequestParam
(
SysJob
sysJob
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
sysJob
,
model
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"save/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"保存定时任务调度(Content-Type为application/json)"
,
notes
=
"保存定时任务调度(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
saveRequestBody
(
@RequestBody
SysJob
sysJob
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
return
save
(
sysJob
,
model
,
redirectAttributes
);
}
private
Result
save
(
SysJob
sysJob
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
sysJob
)){
Result
result
=
ResultFactory
.
getErrorResult
(
"数据验证失败"
);
}
sysJobService
.
save
(
sysJob
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"保存定时任务调度成功"
);
return
result
;
}
/**
* 删除定时任务调度
*/
//RequiresPermissions("job:sysJob:del")
@RequestMapping
(
value
=
"delete"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"删除定时任务调度(Content-Type为text/html)"
,
notes
=
"删除定时任务调度(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
deleteRequestParam
(
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
sysJob
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"delete/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"删除定时任务调度(Content-Type为application/json)"
,
notes
=
"删除定时任务调度(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
deleteRequestBody
(
@RequestBody
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
return
delete
(
sysJob
,
redirectAttributes
);
}
private
Result
delete
(
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
sysJobService
.
delete
(
sysJob
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度成功"
);
return
result
;
}
/**
* 删除定时任务调度(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑删除定时任务调度(Content-Type为text/html)"
,
notes
=
"逻辑删除定时任务调度(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"query"
)
public
Result
deleteByLogicRequestParam
(
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
sysJob
,
redirectAttributes
);
}
/**
* 删除定时任务调度(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑删除定时任务调度(Content-Type为application/json)"
,
notes
=
"逻辑删除定时任务调度(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"sysJob"
,
value
=
"定时任务调度"
,
dataType
=
"SysJob"
,
paramType
=
"body"
)
public
Result
deleteByLogicRequestBody
(
@RequestBody
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
return
deleteByLogic
(
sysJob
,
redirectAttributes
);
}
private
Result
deleteByLogic
(
SysJob
sysJob
,
RedirectAttributes
redirectAttributes
)
{
sysJobService
.
deleteByLogic
(
sysJob
);
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度成功"
);
return
result
;
}
/**
* 批量删除定时任务调度
*/
//RequiresPermissions("job:sysJob:del")
@RequestMapping
(
value
=
"deleteAll"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"批量删除定时任务调度(Content-Type为text/html)"
,
notes
=
"批量删除定时任务调度(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
@RequestMapping
(
value
=
"deleteAll/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"批量删除定时任务调度(Content-Type为application/json)"
,
notes
=
"批量删除定时任务调度(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAll
(
ids
,
redirectAttributes
);
}
private
Result
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
sysJobService
.
delete
(
sysJobService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度成功"
);
return
result
;
}
/**
* 批量删除定时任务调度(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic"
,
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"逻辑批量删除定时任务调度(Content-Type为text/html)"
,
notes
=
"逻辑批量删除定时任务调度(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
deleteAllByLogicRequestParam
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
/**
* 批量删除定时任务调度(逻辑删除,更新del_flag字段为1,在表包含字段del_flag时,可以调用此方法,将数据隐藏)
*/
@RequestMapping
(
value
=
"deleteAllByLogic/json"
,
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"逻辑批量删除定时任务调度(Content-Type为application/json)"
,
notes
=
"逻辑批量删除定时任务调度(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"定时任务调度ids,用,隔开"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
deleteAllByLogicRequestBody
(
@RequestBody
String
ids
,
RedirectAttributes
redirectAttributes
)
{
return
deleteAllByLogic
(
ids
,
redirectAttributes
);
}
private
Result
deleteAllByLogic
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
idArray
[]
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
sysJobService
.
deleteByLogic
(
sysJobService
.
get
(
id
));
}
Result
result
=
ResultFactory
.
getSuccessResult
(
"删除定时任务调度成功"
);
return
result
;
}
}
\ No newline at end of file
Prev
1
…
11
12
13
14
15
16
17
18
19
20
Next
Write
Preview
Supports
Markdown
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