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
JeeSpringCloud
Commits
05beecd0
Commit
05beecd0
authored
Nov 12, 2018
by
Huang
Browse files
no commit message
parent
bc5dd330
Changes
368
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 368+
files are displayed.
Plain diff
Email patch
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/mvvmoa/web/FormLeavemController.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.mvvmoa.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.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.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.mvvmoa.entity.FormLeavem
;
import
com.jeespring.modules.mvvmoa.service.FormLeavemService
;
/**
* 员工请假Controller
* @author JeeSpring
* @version 2017-07-17
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/mvvmoa/formLeavem"
)
public
class
FormLeavemController
extends
AbstractBaseController
{
@Autowired
private
FormLeavemService
formLeavemService
;
@ModelAttribute
public
FormLeavem
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
FormLeavem
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
formLeavemService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
FormLeavem
();
}
return
entity
;
}
@RequestMapping
(
value
=
{
"getjson"
})
@ResponseBody
public
FormLeavem
getjson
(
@RequestParam
(
required
=
false
)
String
id
)
{
FormLeavem
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
formLeavemService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
FormLeavem
();
}
return
entity
;
}
/**
* 请假单列表页面
*/
//RequiresPermissions("mvvmoa:formLeavem:list")
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
FormLeavem
formLeavem
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
FormLeavem
>
page
=
formLeavemService
.
findPage
(
new
Page
<
FormLeavem
>(
request
,
response
),
formLeavem
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/mvvmoa/formLeavemList"
;
}
@RequestMapping
(
value
=
{
"listjson"
})
@ResponseBody
public
Page
<
FormLeavem
>
listjson
(
FormLeavem
formLeavem
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Page
<
FormLeavem
>
page
=
formLeavemService
.
findPage
(
new
Page
<
FormLeavem
>(
request
,
response
),
formLeavem
);
return
page
;
}
/**
* 查看,增加,编辑请假单表单页面
*/
//RequiresPermissions(value={"mvvmoa:formLeavem:view","mvvmoa:formLeavem:add","mvvmoa:formLeavem:edit"},logical=Logical.OR)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
FormLeavem
formLeavem
,
Model
model
)
{
model
.
addAttribute
(
"formLeavem"
,
formLeavem
);
return
"modules/mvvmoa/formLeavemForm"
;
}
/**
* 保存请假单
*/
//RequiresPermissions(value={"mvvmoa:formLeavem:add","mvvmoa:formLeavem:edit"},logical=Logical.OR)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
FormLeavem
formLeavem
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
formLeavem
)){
return
form
(
formLeavem
,
model
);
}
formLeavemService
.
save
(
formLeavem
);
addMessage
(
redirectAttributes
,
"保存请假单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
@RequestMapping
(
value
=
"savejson"
)
@ResponseBody
public
String
savejson
(
FormLeavem
formLeavem
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
formLeavem
)){
return
form
(
formLeavem
,
model
);
}
formLeavemService
.
save
(
formLeavem
);
//addMessage(redirectAttributes, "保存请假单成功");
return
"保存请假单成功"
;
}
/**
* 删除请假单
*/
//RequiresPermissions("mvvmoa:formLeavem:del")
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
FormLeavem
formLeavem
,
RedirectAttributes
redirectAttributes
)
{
formLeavemService
.
delete
(
formLeavem
);
addMessage
(
redirectAttributes
,
"删除请假单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
@RequestMapping
(
value
=
"deletejson"
)
@ResponseBody
public
String
deletejson
(
FormLeavem
formLeavem
,
RedirectAttributes
redirectAttributes
)
{
formLeavemService
.
delete
(
formLeavem
);
//addMessage(redirectAttributes, "删除请假单成功");
return
"删除请假单成功"
;
}
/**
* 批量删除请假单
*/
//RequiresPermissions("mvvmoa:formLeavem:del")
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
[]
idArray
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
formLeavemService
.
delete
(
formLeavemService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除请假单成功"
);
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
/**
* 导出excel文件
*/
//RequiresPermissions("mvvmoa:formLeavem:export")
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
POST
)
public
String
exportFile
(
FormLeavem
formLeavem
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"请假单"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)+
".xlsx"
;
Page
<
FormLeavem
>
page
=
formLeavemService
.
findPage
(
new
Page
<
FormLeavem
>(
request
,
response
,
-
1
),
formLeavem
);
new
ExportExcel
(
"请假单"
,
FormLeavem
.
class
).
setDataList
(
page
.
getList
()).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导出请假单记录失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
/**
* 导入Excel数据
*/
//RequiresPermissions("mvvmoa:formLeavem:import")
@RequestMapping
(
value
=
"import"
,
method
=
RequestMethod
.
POST
)
public
String
importFile
(
MultipartFile
file
,
RedirectAttributes
redirectAttributes
)
{
try
{
int
successNum
=
0
;
ImportExcel
ei
=
new
ImportExcel
(
file
,
1
,
0
);
List
<
FormLeavem
>
list
=
ei
.
getDataList
(
FormLeavem
.
class
);
for
(
FormLeavem
formLeavem
:
list
){
formLeavemService
.
save
(
formLeavem
);
}
addMessage
(
redirectAttributes
,
"已成功导入 "
+
successNum
+
" 条请假单记录"
);
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入请假单失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
/**
* 下载导入请假单数据模板
*/
//RequiresPermissions("mvvmoa:formLeavem:import")
@RequestMapping
(
value
=
"import/template"
)
public
String
importFileTemplate
(
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
try
{
String
fileName
=
"请假单数据导入模板.xlsx"
;
List
<
FormLeavem
>
list
=
Lists
.
newArrayList
();
new
ExportExcel
(
"请假单数据"
,
FormLeavem
.
class
,
1
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导入模板下载失败!失败信息:"
+
e
.
getMessage
());
}
return
"redirect:"
+
Global
.
getAdminPath
()+
"/mvvmoa/formLeavem/?repage"
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/dao/OaNotifyDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.oa.entity.OaNotify
;
/**
* 通知通告DAO接口
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
@Mapper
public
interface
OaNotifyDao
extends
InterfaceBaseDao
<
OaNotify
>
{
/**
* 获取通知数目
* @param oaNotify
* @return
*/
Long
findCount
(
OaNotify
oaNotify
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/dao/OaNotifyRecordDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.dao
;
import
java.util.List
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.oa.entity.OaNotifyRecord
;
/**
* 通知通告记录DAO接口
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
@Mapper
public
interface
OaNotifyRecordDao
extends
InterfaceBaseDao
<
OaNotifyRecord
>
{
/**
* 插入通知记录
* @param oaNotifyRecordList
* @return
*/
int
insertAll
(
List
<
OaNotifyRecord
>
oaNotifyRecordList
);
/**
* 根据通知ID删除通知记录
* @param oaNotifyId 通知ID
* @return
*/
int
deleteByOaNotifyId
(
String
oaNotifyId
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/dao/TestAuditDao.java
0 → 100644
View file @
05beecd0
/**
* Copyright © 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.oa.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
com.jeespring.common.persistence.annotation.MyBatisDao
;
import
com.jeespring.modules.oa.entity.TestAudit
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 审批DAO接口
* @author thinkgem
* @version 2014-05-16
*/
@Mapper
public
interface
TestAuditDao
extends
InterfaceBaseDao
<
TestAudit
>
{
public
TestAudit
getByProcInsId
(
String
procInsId
);
public
int
updateInsId
(
TestAudit
testAudit
);
public
int
updateHrText
(
TestAudit
testAudit
);
public
int
updateLeadText
(
TestAudit
testAudit
);
public
int
updateMainLeadText
(
TestAudit
testAudit
);
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/entity/OaNotify.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.entity
;
import
java.util.List
;
import
org.hibernate.validator.constraints.Length
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.utils.Collections3
;
import
com.jeespring.common.utils.IdGen
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.modules.sys.entity.User
;
/**
* 通知通告Entity
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
public
class
OaNotify
extends
AbstractBaseEntity
<
OaNotify
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
type
;
// 类型
private
String
title
;
// 标题
private
String
content
;
// 类型
private
String
files
;
// 附件
private
String
status
;
// 状态
private
String
readNum
;
// 已读
private
String
unReadNum
;
// 未读
private
boolean
isSelf
;
// 是否只查询自己的通知
private
String
readFlag
;
// 本人阅读状态
private
List
<
OaNotifyRecord
>
oaNotifyRecordList
=
Lists
.
newArrayList
();
public
OaNotify
()
{
super
();
}
public
OaNotify
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
200
,
message
=
"标题长度必须介于 0 和 200 之间"
)
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Length
(
min
=
0
,
max
=
1
,
message
=
"类型长度必须介于 0 和 1 之间"
)
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
@Length
(
min
=
0
,
max
=
1
,
message
=
"状态长度必须介于 0 和 1 之间"
)
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
@Length
(
min
=
0
,
max
=
2000
,
message
=
"附件长度必须介于 0 和 2000 之间"
)
public
String
getFiles
()
{
return
files
;
}
public
void
setFiles
(
String
files
)
{
this
.
files
=
files
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getReadNum
()
{
return
readNum
;
}
public
void
setReadNum
(
String
readNum
)
{
this
.
readNum
=
readNum
;
}
public
String
getUnReadNum
()
{
return
unReadNum
;
}
public
void
setUnReadNum
(
String
unReadNum
)
{
this
.
unReadNum
=
unReadNum
;
}
public
List
<
OaNotifyRecord
>
getOaNotifyRecordList
()
{
return
oaNotifyRecordList
;
}
public
void
setOaNotifyRecordList
(
List
<
OaNotifyRecord
>
oaNotifyRecordList
)
{
this
.
oaNotifyRecordList
=
oaNotifyRecordList
;
}
/**
* 获取通知发送记录用户ID
* @return
*/
public
String
getOaNotifyRecordIds
()
{
return
Collections3
.
extractToString
(
oaNotifyRecordList
,
"user.id"
,
","
)
;
}
/**
* 设置通知发送记录用户ID
* @return
*/
public
void
setOaNotifyRecordIds
(
String
oaNotifyRecord
)
{
this
.
oaNotifyRecordList
=
Lists
.
newArrayList
();
for
(
String
id
:
StringUtils
.
split
(
oaNotifyRecord
,
","
)){
OaNotifyRecord
entity
=
new
OaNotifyRecord
();
entity
.
setId
(
IdGen
.
uuid
());
entity
.
setOaNotify
(
this
);
entity
.
setUser
(
new
User
(
id
));
entity
.
setReadFlag
(
"0"
);
this
.
oaNotifyRecordList
.
add
(
entity
);
}
}
/**
* 获取通知发送记录用户Name
* @return
*/
public
String
getOaNotifyRecordNames
()
{
return
Collections3
.
extractToString
(
oaNotifyRecordList
,
"user.name"
,
","
)
;
}
/**
* 设置通知发送记录用户Name
* @return
*/
public
void
setOaNotifyRecordNames
(
String
oaNotifyRecord
)
{
// 什么也不做
}
public
boolean
isSelf
()
{
return
isSelf
;
}
public
void
setSelf
(
boolean
isSelf
)
{
this
.
isSelf
=
isSelf
;
}
public
String
getReadFlag
()
{
return
readFlag
;
}
public
void
setReadFlag
(
String
readFlag
)
{
this
.
readFlag
=
readFlag
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/entity/OaNotifyRecord.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.entity
;
import
org.hibernate.validator.constraints.Length
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
import
com.jeespring.modules.sys.entity.User
;
import
java.util.Date
;
/**
* 通知通告记录Entity
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
public
class
OaNotifyRecord
extends
AbstractBaseEntity
<
OaNotifyRecord
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
OaNotify
oaNotify
;
// 通知通告ID
private
User
user
;
// 接受人
private
String
readFlag
;
// 阅读标记(0:未读;1:已读)
private
Date
readDate
;
// 阅读时间
public
OaNotifyRecord
()
{
super
();
}
public
OaNotifyRecord
(
String
id
){
super
(
id
);
}
public
OaNotifyRecord
(
OaNotify
oaNotify
){
this
.
oaNotify
=
oaNotify
;
}
public
OaNotify
getOaNotify
()
{
return
oaNotify
;
}
public
void
setOaNotify
(
OaNotify
oaNotify
)
{
this
.
oaNotify
=
oaNotify
;
}
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
@Length
(
min
=
0
,
max
=
1
,
message
=
"阅读标记(0:未读;1:已读)长度必须介于 0 和 1 之间"
)
public
String
getReadFlag
()
{
return
readFlag
;
}
public
void
setReadFlag
(
String
readFlag
)
{
this
.
readFlag
=
readFlag
;
}
public
Date
getReadDate
()
{
return
readDate
;
}
public
void
setReadDate
(
Date
readDate
)
{
this
.
readDate
=
readDate
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/entity/TestAudit.java
0 → 100644
View file @
05beecd0
/**
* Copyright © 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.oa.entity
;
import
com.jeespring.common.persistence.ActEntity
;
import
com.jeespring.modules.sys.entity.Office
;
import
com.jeespring.modules.sys.entity.User
;
/**
* 审批Entity
* @author thinkgem
* @version 2014-05-16
*/
public
class
TestAudit
extends
ActEntity
<
TestAudit
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
User
user
;
// 归属用户
private
Office
office
;
// 归属部门
private
String
post
;
// 岗位
private
String
age
;
// 性别
private
String
edu
;
// 学历
private
String
content
;
// 调整原因
private
String
olda
;
// 现行标准 薪酬档级
private
String
oldb
;
// 现行标准 月工资额
private
String
oldc
;
// 现行标准 年薪总额
private
String
newa
;
// 调整后标准 薪酬档级
private
String
newb
;
// 调整后标准 月工资额
private
String
newc
;
// 调整后标准 年薪总额
private
String
addNum
;
// 月增资
private
String
exeDate
;
// 执行时间
private
String
hrText
;
// 人力资源部门意见
private
String
leadText
;
// 分管领导意见
private
String
mainLeadText
;
// 集团主要领导意见
public
TestAudit
()
{
super
();
}
public
TestAudit
(
String
id
){
super
(
id
);
}
public
String
getPost
()
{
return
post
;
}
public
void
setPost
(
String
post
)
{
this
.
post
=
post
;
}
public
String
getAge
()
{
return
age
;
}
public
void
setAge
(
String
age
)
{
this
.
age
=
age
;
}
public
String
getEdu
()
{
return
edu
;
}
public
void
setEdu
(
String
edu
)
{
this
.
edu
=
edu
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getOlda
()
{
return
olda
;
}
public
void
setOlda
(
String
olda
)
{
this
.
olda
=
olda
;
}
public
String
getOldb
()
{
return
oldb
;
}
public
void
setOldb
(
String
oldb
)
{
this
.
oldb
=
oldb
;
}
public
String
getOldc
()
{
return
oldc
;
}
public
void
setOldc
(
String
oldc
)
{
this
.
oldc
=
oldc
;
}
public
String
getNewa
()
{
return
newa
;
}
public
void
setNewa
(
String
newa
)
{
this
.
newa
=
newa
;
}
public
String
getNewb
()
{
return
newb
;
}
public
void
setNewb
(
String
newb
)
{
this
.
newb
=
newb
;
}
public
String
getNewc
()
{
return
newc
;
}
public
void
setNewc
(
String
newc
)
{
this
.
newc
=
newc
;
}
public
String
getExeDate
()
{
return
exeDate
;
}
public
void
setExeDate
(
String
exeDate
)
{
this
.
exeDate
=
exeDate
;
}
public
String
getHrText
()
{
return
hrText
;
}
public
void
setHrText
(
String
hrText
)
{
this
.
hrText
=
hrText
;
}
public
String
getLeadText
()
{
return
leadText
;
}
public
void
setLeadText
(
String
leadText
)
{
this
.
leadText
=
leadText
;
}
public
String
getMainLeadText
()
{
return
mainLeadText
;
}
public
void
setMainLeadText
(
String
mainLeadText
)
{
this
.
mainLeadText
=
mainLeadText
;
}
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
Office
getOffice
()
{
return
office
;
}
public
void
setOffice
(
Office
office
)
{
this
.
office
=
office
;
}
public
String
getAddNum
()
{
return
addNum
;
}
public
void
setAddNum
(
String
addNum
)
{
this
.
addNum
=
addNum
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/service/OaNotifyService.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.service
;
import
java.util.Date
;
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.oa.dao.OaNotifyDao
;
import
com.jeespring.modules.oa.dao.OaNotifyRecordDao
;
import
com.jeespring.modules.oa.entity.OaNotify
;
import
com.jeespring.modules.oa.entity.OaNotifyRecord
;
/**
* 通知通告Service
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
OaNotifyService
extends
AbstractBaseService
<
OaNotifyDao
,
OaNotify
>
{
@Autowired
private
OaNotifyRecordDao
oaNotifyRecordDao
;
@Override
public
OaNotify
get
(
String
id
)
{
OaNotify
entity
=
dao
.
get
(
id
);
return
entity
;
}
/**
* 获取通知发送记录
* @param oaNotify
* @return
*/
public
OaNotify
getRecordList
(
OaNotify
oaNotify
)
{
oaNotify
.
setOaNotifyRecordList
(
oaNotifyRecordDao
.
findList
(
new
OaNotifyRecord
(
oaNotify
)));
return
oaNotify
;
}
public
Page
<
OaNotify
>
find
(
Page
<
OaNotify
>
page
,
OaNotify
oaNotify
)
{
oaNotify
.
setPage
(
page
);
page
.
setList
(
dao
.
findList
(
oaNotify
));
return
page
;
}
/**
* 获取通知数目
* @param oaNotify
* @return
*/
public
Long
findCount
(
OaNotify
oaNotify
)
{
return
dao
.
findCount
(
oaNotify
);
}
@Override
@Transactional
(
readOnly
=
false
)
public
void
save
(
OaNotify
oaNotify
)
{
super
.
save
(
oaNotify
);
// 更新发送接受人记录
oaNotifyRecordDao
.
deleteByOaNotifyId
(
oaNotify
.
getId
());
if
(
oaNotify
.
getOaNotifyRecordList
().
size
()
>
0
){
oaNotifyRecordDao
.
insertAll
(
oaNotify
.
getOaNotifyRecordList
());
}
}
/**
* 更新阅读状态
*/
@Transactional
(
readOnly
=
false
)
public
void
updateReadFlag
(
OaNotify
oaNotify
)
{
OaNotifyRecord
oaNotifyRecord
=
new
OaNotifyRecord
(
oaNotify
);
oaNotifyRecord
.
setUser
(
oaNotifyRecord
.
getCurrentUser
());
oaNotifyRecord
.
setReadDate
(
new
Date
());
oaNotifyRecord
.
setReadFlag
(
"1"
);
oaNotifyRecordDao
.
update
(
oaNotifyRecord
);
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/service/TestAuditService.java
0 → 100644
View file @
05beecd0
/**
* Copyright © 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.oa.service
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.google.common.collect.Maps
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractBaseService
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.modules.act.service.ActTaskService
;
import
com.jeespring.modules.act.utils.ActUtils
;
import
com.jeespring.modules.oa.entity.TestAudit
;
import
com.jeespring.modules.oa.dao.TestAuditDao
;
/**
* 审批Service
* @author thinkgem
* @version 2014-05-16
*/
@Service
@Transactional
(
readOnly
=
true
)
public
class
TestAuditService
extends
AbstractBaseService
<
TestAuditDao
,
TestAudit
>
{
@Autowired
private
ActTaskService
actTaskService
;
public
TestAudit
getByProcInsId
(
String
procInsId
)
{
return
dao
.
getByProcInsId
(
procInsId
);
}
@Override
public
Page
<
TestAudit
>
findPage
(
Page
<
TestAudit
>
page
,
TestAudit
testAudit
)
{
testAudit
.
setPage
(
page
);
page
.
setList
(
dao
.
findList
(
testAudit
));
return
page
;
}
/**
* 审核新增或编辑
* @param testAudit
*/
@Override
@Transactional
(
readOnly
=
false
)
public
void
save
(
TestAudit
testAudit
)
{
// 申请发起
if
(
StringUtils
.
isBlank
(
testAudit
.
getId
())){
testAudit
.
preInsert
();
dao
.
insert
(
testAudit
);
// 启动流程
actTaskService
.
startProcess
(
ActUtils
.
PD_TEST_AUDIT
[
0
],
ActUtils
.
PD_TEST_AUDIT
[
1
],
testAudit
.
getId
(),
testAudit
.
getContent
());
}
// 重新编辑申请
else
{
testAudit
.
preUpdate
();
dao
.
update
(
testAudit
);
testAudit
.
getAct
().
setComment
((
"yes"
.
equals
(
testAudit
.
getAct
().
getFlag
())?
"[重申] "
:
"[销毁] "
)+
testAudit
.
getAct
().
getComment
());
// 完成流程任务
Map
<
String
,
Object
>
vars
=
Maps
.
newHashMap
();
vars
.
put
(
"pass"
,
"yes"
.
equals
(
testAudit
.
getAct
().
getFlag
())?
"1"
:
"0"
);
actTaskService
.
complete
(
testAudit
.
getAct
().
getTaskId
(),
testAudit
.
getAct
().
getProcInsId
(),
testAudit
.
getAct
().
getComment
(),
testAudit
.
getContent
(),
vars
);
}
}
/**
* 审核审批保存
* @param testAudit
*/
@Transactional
(
readOnly
=
false
)
public
void
auditSave
(
TestAudit
testAudit
)
{
// 设置意见
testAudit
.
getAct
().
setComment
((
"yes"
.
equals
(
testAudit
.
getAct
().
getFlag
())?
"[同意] "
:
"[驳回] "
)+
testAudit
.
getAct
().
getComment
());
testAudit
.
preUpdate
();
// 对不同环节的业务逻辑进行操作
String
taskDefKey
=
testAudit
.
getAct
().
getTaskDefKey
();
// 审核环节
if
(
"audit"
.
equals
(
taskDefKey
)){
}
else
if
(
"audit2"
.
equals
(
taskDefKey
)){
testAudit
.
setHrText
(
testAudit
.
getAct
().
getComment
());
dao
.
updateHrText
(
testAudit
);
}
else
if
(
"audit3"
.
equals
(
taskDefKey
)){
testAudit
.
setLeadText
(
testAudit
.
getAct
().
getComment
());
dao
.
updateLeadText
(
testAudit
);
}
else
if
(
"audit4"
.
equals
(
taskDefKey
)){
testAudit
.
setMainLeadText
(
testAudit
.
getAct
().
getComment
());
dao
.
updateMainLeadText
(
testAudit
);
}
else
if
(
"apply_end"
.
equals
(
taskDefKey
)){
}
// 未知环节,直接返回
else
{
return
;
}
// 提交流程任务
Map
<
String
,
Object
>
vars
=
Maps
.
newHashMap
();
vars
.
put
(
"pass"
,
"yes"
.
equals
(
testAudit
.
getAct
().
getFlag
())?
"1"
:
"0"
);
actTaskService
.
complete
(
testAudit
.
getAct
().
getTaskId
(),
testAudit
.
getAct
().
getProcInsId
(),
testAudit
.
getAct
().
getComment
(),
vars
);
// vars.put("var_test", "yes_no_test2");
// actTaskService.getProcessEngine().getTaskService().addComment(testAudit.getAct().getTaskId(), testAudit.getAct().getProcInsId(), testAudit.getAct().getComment());
// actTaskService.jumpTask(testAudit.getAct().getProcInsId(), testAudit.getAct().getTaskId(), "audit2", vars);
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/web/OaNotifyController.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oa.web
;
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.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.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.oa.entity.OaNotify
;
import
com.jeespring.modules.oa.service.OaNotifyService
;
/**
* 通知通告Controller
* @author 黄炳桂 516821420@qq.com
* @version 2014-05-16
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/oa/oaNotify"
)
public
class
OaNotifyController
extends
AbstractBaseController
{
@Autowired
private
OaNotifyService
oaNotifyService
;
@ModelAttribute
public
OaNotify
get
(
@RequestParam
(
required
=
false
)
String
id
)
{
OaNotify
entity
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
entity
=
oaNotifyService
.
get
(
id
);
}
if
(
entity
==
null
){
entity
=
new
OaNotify
();
}
return
entity
;
}
@RequiresPermissions
(
"oa:oaNotify:list"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
OaNotify
oaNotify
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
throws
Exception
{
Page
<
OaNotify
>
page
=
new
Page
<
OaNotify
>();
page
=
oaNotifyService
.
find
(
new
Page
<
OaNotify
>(
request
,
response
),
oaNotify
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/oa/oaNotifyList"
;
}
/**
* 查看,增加,编辑报告表单页面
*/
@RequiresPermissions
(
value
={
"oa:oaNotify:view"
,
"oa:oaNotify:add"
,
"oa:oaNotify:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
OaNotify
oaNotify
,
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
model
.
addAttribute
(
"action"
,
request
.
getParameter
(
"action"
));
if
(
StringUtils
.
isNotBlank
(
oaNotify
.
getId
())){
oaNotify
=
oaNotifyService
.
getRecordList
(
oaNotify
);
}
model
.
addAttribute
(
"oaNotify"
,
oaNotify
);
return
"modules/oa/oaNotifyForm"
;
}
@RequiresPermissions
(
value
={
"oa:oaNotify:add"
,
"oa:oaNotify:edit"
},
logical
=
Logical
.
OR
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
OaNotify
oaNotify
,
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
oaNotify
)){
return
form
(
oaNotify
,
model
,
request
,
response
);
}
// 如果是修改,则状态为已发布,则不能再进行操作
if
(
StringUtils
.
isNotBlank
(
oaNotify
.
getId
())){
OaNotify
e
=
oaNotifyService
.
get
(
oaNotify
.
getId
());
if
(
"1"
.
equals
(
e
.
getStatus
())){
addMessage
(
redirectAttributes
,
"已发布,不能操作!"
);
return
"redirect:"
+
adminPath
+
"/oa/oaNotify/?repage"
;
}
}
oaNotifyService
.
save
(
oaNotify
);
addMessage
(
redirectAttributes
,
"保存通知'"
+
oaNotify
.
getTitle
()
+
"'成功"
);
return
"redirect:"
+
adminPath
+
"/oa/oaNotify/?repage"
;
}
@RequiresPermissions
(
"oa:oaNotify:del"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
OaNotify
oaNotify
,
RedirectAttributes
redirectAttributes
)
{
oaNotifyService
.
delete
(
oaNotify
);
addMessage
(
redirectAttributes
,
"删除通知成功"
);
return
"redirect:"
+
adminPath
+
"/oa/oaNotify/?repage"
;
}
@RequiresPermissions
(
"oa:oaNotify:del"
)
@RequestMapping
(
value
=
"deleteAll"
)
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
String
[]
idArray
=
ids
.
split
(
","
);
long
successCount
=
0
,
failureCount
=
0
;
String
failureMsg
=
""
;
for
(
String
id
:
idArray
){
OaNotify
oaNotify
=
oaNotifyService
.
get
(
id
);
if
(
oaNotify
==
null
){
failureCount
++;
failureMsg
+=
"id:"
+
id
+
",查询数据为空;"
;
continue
;
}
oaNotifyService
.
delete
(
oaNotifyService
.
get
(
id
));
successCount
++;
}
addMessage
(
redirectAttributes
,
"删除通知成功条数:"
+
successCount
+
",删除通知失败条数:"
+
failureCount
+
",失败信息:"
+
failureMsg
+
""
);
return
"redirect:"
+
adminPath
+
"/oa/oaNotify/?repage"
;
}
/**
* 我的通知列表
* @throws Exception
*/
@RequestMapping
(
value
=
"self"
)
public
String
selfList
(
OaNotify
oaNotify
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
throws
Exception
{
oaNotify
.
setSelf
(
true
);
Page
<
OaNotify
>
page
=
new
Page
<
OaNotify
>();
page
=
oaNotifyService
.
find
(
new
Page
<
OaNotify
>(
request
,
response
),
oaNotify
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/oa/oaNotifyList"
;
}
/**
* 我的通知列表-数据
*/
@RequiresPermissions
(
"oa:oaNotify:view"
)
@RequestMapping
(
value
=
"selfData"
)
@ResponseBody
public
Page
<
OaNotify
>
listData
(
OaNotify
oaNotify
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
oaNotify
.
setSelf
(
true
);
Page
<
OaNotify
>
page
=
oaNotifyService
.
find
(
new
Page
<
OaNotify
>(
request
,
response
),
oaNotify
);
return
page
;
}
/**
* 查看我的通知,重定向在当前页面打开
*/
@RequestMapping
(
value
=
"view"
)
public
String
view
(
OaNotify
oaNotify
,
Model
model
)
{
if
(
StringUtils
.
isNotBlank
(
oaNotify
.
getId
())){
oaNotifyService
.
updateReadFlag
(
oaNotify
);
oaNotify
=
oaNotifyService
.
getRecordList
(
oaNotify
);
model
.
addAttribute
(
"oaNotify"
,
oaNotify
);
return
"modules/oa/oaNotifyForm"
;
}
return
"redirect:"
+
adminPath
+
"/oa/oaNotify/self?repage"
;
}
/**
* 查看我的通知-数据
*/
@RequestMapping
(
value
=
"viewData"
)
@ResponseBody
public
OaNotify
viewData
(
OaNotify
oaNotify
,
Model
model
)
{
if
(
StringUtils
.
isNotBlank
(
oaNotify
.
getId
())){
oaNotifyService
.
updateReadFlag
(
oaNotify
);
return
oaNotify
;
}
return
null
;
}
/**
* 查看我的通知-发送记录
*/
@RequestMapping
(
value
=
"viewRecordData"
)
@ResponseBody
public
OaNotify
viewRecordData
(
OaNotify
oaNotify
,
Model
model
)
{
if
(
StringUtils
.
isNotBlank
(
oaNotify
.
getId
())){
oaNotify
=
oaNotifyService
.
getRecordList
(
oaNotify
);
return
oaNotify
;
}
return
null
;
}
/**
* 获取我的通知数目
*/
@RequestMapping
(
value
=
"self/count"
)
@ResponseBody
public
String
selfCount
(
OaNotify
oaNotify
,
Model
model
)
{
oaNotify
.
setSelf
(
true
);
oaNotify
.
setReadFlag
(
"0"
);
return
String
.
valueOf
(
oaNotifyService
.
findCount
(
oaNotify
));
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oa/web/TestAuditController.java
0 → 100644
View file @
05beecd0
/**
* Copyright © 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package
com.jeespring.modules.oa.web
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.StringUtils
;
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.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.utils.UserUtils
;
import
com.jeespring.modules.oa.entity.TestAudit
;
import
com.jeespring.modules.oa.service.TestAuditService
;
/**
* 审批Controller
* @author thinkgem
* @version 2014-05-16
*/
@Controller
@RequestMapping
(
value
=
"${adminPath}/oa/testAudit"
)
public
class
TestAuditController
extends
AbstractBaseController
{
@Autowired
private
TestAuditService
testAuditService
;
@ModelAttribute
public
TestAudit
get
(
@RequestParam
(
required
=
false
)
String
id
){
//,
// @RequestParam(value="act.procInsId", required=false) String procInsId) {
TestAudit
testAudit
=
null
;
if
(
StringUtils
.
isNotBlank
(
id
)){
testAudit
=
testAuditService
.
get
(
id
);
// }else if (StringUtils.isNotBlank(procInsId)){
// testAudit = testAuditService.getByProcInsId(procInsId);
}
if
(
testAudit
==
null
){
testAudit
=
new
TestAudit
();
}
return
testAudit
;
}
@RequiresPermissions
(
"oa:testAudit:view"
)
@RequestMapping
(
value
=
{
"list"
,
""
})
public
String
list
(
TestAudit
testAudit
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
User
user
=
UserUtils
.
getUser
();
if
(!
user
.
isAdmin
()){
testAudit
.
setCreateBy
(
user
);
}
Page
<
TestAudit
>
page
=
testAuditService
.
findPage
(
new
Page
<
TestAudit
>(
request
,
response
),
testAudit
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/oa/testAuditList"
;
}
/**
* 申请单填写
* @param testAudit
* @param model
* @return
*/
@RequiresPermissions
(
"oa:testAudit:view"
)
@RequestMapping
(
value
=
"form"
)
public
String
form
(
TestAudit
testAudit
,
Model
model
)
{
String
view
=
"testAuditForm"
;
// 查看审批申请单
if
(
StringUtils
.
isNotBlank
(
testAudit
.
getId
())){
//.getAct().getProcInsId())){
// 环节编号
String
taskDefKey
=
testAudit
.
getAct
().
getTaskDefKey
();
// 查看工单
if
(
testAudit
.
getAct
().
isFinishTask
()){
view
=
"testAuditView"
;
}
// 修改环节
else
if
(
"modify"
.
equals
(
taskDefKey
)){
view
=
"testAuditForm"
;
}
// 审核环节
else
if
(
"audit"
.
equals
(
taskDefKey
)){
view
=
"testAuditAudit"
;
// String formKey = "/oa/testAudit";
// return "redirect:" + ActUtils.getFormUrl(formKey, testAudit.getAct());
}
// 审核环节2
else
if
(
"audit2"
.
equals
(
taskDefKey
)){
view
=
"testAuditAudit"
;
}
// 审核环节3
else
if
(
"audit3"
.
equals
(
taskDefKey
)){
view
=
"testAuditAudit"
;
}
// 审核环节4
else
if
(
"audit4"
.
equals
(
taskDefKey
)){
view
=
"testAuditAudit"
;
}
// 兑现环节
else
if
(
"apply_end"
.
equals
(
taskDefKey
)){
view
=
"testAuditAudit"
;
}
}
model
.
addAttribute
(
"testAudit"
,
testAudit
);
return
"modules/oa/"
+
view
;
}
/**
* 申请单保存/修改
* @param testAudit
* @param model
* @param redirectAttributes
* @return
*/
@RequiresPermissions
(
"oa:testAudit:edit"
)
@RequestMapping
(
value
=
"save"
)
public
String
save
(
TestAudit
testAudit
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(!
beanValidator
(
model
,
testAudit
)){
return
form
(
testAudit
,
model
);
}
testAuditService
.
save
(
testAudit
);
addMessage
(
redirectAttributes
,
"提交审批'"
+
testAudit
.
getUser
().
getName
()
+
"'成功"
);
return
"redirect:"
+
adminPath
+
"/act/task/todo/"
;
}
/**
* 工单执行(完成任务)
* @param testAudit
* @param model
* @return
*/
@RequiresPermissions
(
"oa:testAudit:edit"
)
@RequestMapping
(
value
=
"saveAudit"
)
public
String
saveAudit
(
TestAudit
testAudit
,
Model
model
)
{
if
(
StringUtils
.
isBlank
(
testAudit
.
getAct
().
getFlag
())
||
StringUtils
.
isBlank
(
testAudit
.
getAct
().
getComment
())){
addMessage
(
model
,
"请填写审核意见。"
);
return
form
(
testAudit
,
model
);
}
testAuditService
.
auditSave
(
testAudit
);
return
"redirect:"
+
adminPath
+
"/act/task/todo/"
;
}
/**
* 删除工单
* @param id
* @param redirectAttributes
* @return
*/
@RequiresPermissions
(
"oa:testAudit:edit"
)
@RequestMapping
(
value
=
"delete"
)
public
String
delete
(
TestAudit
testAudit
,
RedirectAttributes
redirectAttributes
)
{
testAuditService
.
delete
(
testAudit
);
addMessage
(
redirectAttributes
,
"删除审批成功"
);
return
"redirect:"
+
adminPath
+
"/oa/testAudit/?repage"
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oauth/entity/TokenInfo.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.oauth.entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
TokenInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
token
;
private
Date
tokenDate
;
private
String
oauthId
;
private
String
oauthSecret
;
private
String
ip
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
Date
getTokenDate
()
{
return
tokenDate
;
}
public
void
setTokenDate
(
Date
tokenDate
)
{
this
.
tokenDate
=
tokenDate
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getOauthId
()
{
return
oauthId
;
}
public
void
setOauthId
(
String
oauthId
)
{
this
.
oauthId
=
oauthId
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getOauthSecret
()
{
return
oauthSecret
;
}
public
void
setOauthSecret
(
String
oauthSecret
)
{
this
.
oauthSecret
=
oauthSecret
;
}
@JsonIgnore
@JSONField
(
serialize
=
false
)
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oauth/rest/oauthRestController.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.oauth.rest
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
com.jeespring.modules.oauth.service.OauthService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 系统配置Controller
* @author 黄炳桂 516821420@qq.com
* @version 2017-11-17
*/
@RestController
@RequestMapping
(
value
=
"/rest/oauth"
)
@Api
(
value
=
"Oauth平台授权接口(分布式)"
,
description
=
"Oauth平台授权接口(分布式)"
)
public
class
oauthRestController
extends
AbstractBaseController
{
@Autowired
private
OauthService
oauthService
;
@RequestMapping
(
value
=
{
"test"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"token test平台授权测试接口(Content-Type为text/html)"
,
notes
=
"token test平台授权测试接口(Content-Type为text/html)"
)
public
Result
test
()
{
return
ResultFactory
.
getSuccessResult
(
"测试成功!"
);
}
@RequestMapping
(
value
=
{
"token"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"token平台授权接口(Content-Type为text/html)"
,
notes
=
"token平台授权接口(Content-Type为text/html)"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"oauthId"
,
value
=
"客户id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"oauthSecret"
,
value
=
"客户密钥"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
})
public
Result
tokenRequestParam
(
@RequestParam
(
required
=
false
)
String
oauthId
,
@RequestParam
(
required
=
false
)
String
oauthSecret
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
return
oauthService
.
token
(
oauthId
,
oauthSecret
,
request
.
getRemoteAddr
());
}
@RequestMapping
(
value
=
{
"token/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"系统配置信息(Content-Type为application/json)"
,
notes
=
"系统配置信息(Content-Type为application/json)"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"oauthId"
,
value
=
"客户id"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
),
@ApiImplicitParam
(
name
=
"oauthSecret"
,
value
=
"客户密钥"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
})
public
Result
tokenJsonRequestBody
(
@RequestBody
String
oauthId
,
@RequestBody
String
oauthSecret
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
return
oauthService
.
token
(
oauthId
,
oauthSecret
,
request
.
getRemoteAddr
());
}
@RequestMapping
(
value
=
{
"checkToken"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"checkToken平台Token检查接口(Content-Type为text/html)"
,
notes
=
"checkToken平台Token检查接口(Content-Type为text/html)"
)
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"query"
)
public
Result
checkTokenRequestParam
(
@RequestParam
(
required
=
false
)
String
token
,
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
checkToken
(
token
,
request
.
getRemoteAddr
());
}
@RequestMapping
(
value
=
{
"checkToken/json"
},
method
={
RequestMethod
.
POST
})
@ApiOperation
(
value
=
"checkToken平台Token检查接口(Content-Type为application/json)"
,
notes
=
"checkToken平台Token检查接口(Content-Type为application/json)"
)
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
required
=
false
,
dataType
=
"String"
,
paramType
=
"body"
)
public
Result
checkTokenRequestBody
(
@RequestBody
(
required
=
false
)
String
token
,
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
checkToken
(
token
,
request
.
getRemoteAddr
());
}
@RequestMapping
(
value
=
{
"faild"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"授权平台接口失败(Content-Type为application/html)"
,
notes
=
"授权平台接口失败(Content-Type为application/html)"
)
public
Result
faild
(
HttpServletRequest
request
,
HttpServletResponse
response
){
return
ResultFactory
.
getErrorResult
(
"oauth token授权失败!"
);
}
@RequestMapping
(
value
=
{
"apiTimeLimiFaild"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"授权平台调用次数失败(Content-Type为application/html)"
,
notes
=
"授权平台调用次数失败(Content-Type为application/html)"
)
public
Result
apiTimeLimiFaild
(
HttpServletRequest
request
,
HttpServletResponse
response
){
String
apiTimeLimi
=
request
.
getParameter
(
"apiTimeLimi"
);
if
(
apiTimeLimi
==
null
)
{
apiTimeLimi
=
""
;
}
return
ResultFactory
.
getErrorResult
(
"调用失败,接口允许最多调用"
+
apiTimeLimi
+
"次数!15分钟后解锁!"
);
}
@RequestMapping
(
value
=
{
"userOnlineAmountFaild"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"在线用户数量已满失败(Content-Type为application/html)"
,
notes
=
"在线用户数量已满失败(Content-Type为application/html)"
)
public
Result
userOnlineAmountFaild
(
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
userOnlineAmount
();
}
@RequestMapping
(
value
=
{
"userOnlineAmount"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"在线用户数量(Content-Type为application/html)"
,
notes
=
"在线用户数量(Content-Type为application/html)"
)
public
Result
userOnlineAmount
(
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
userOnlineAmount
();
}
@RequestMapping
(
value
=
{
"getApiTimeLimi"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"授权平台调用次数(Content-Type为application/html)"
,
notes
=
"授权平台调用次数(Content-Type为application/html)"
)
public
Result
getApiTimeLimi
(
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
getApiTimeLimi
(
request
.
getRemoteAddr
());
}
@RequestMapping
(
value
=
{
"getApiTime"
},
method
={
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@ApiOperation
(
value
=
"调用次数(Content-Type为application/html)"
,
notes
=
"调用次数(Content-Type为application/html)"
)
public
Result
getApiTime
(
HttpServletRequest
request
,
HttpServletResponse
response
){
return
oauthService
.
getApiTime
();
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/oauth/service/OauthService.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.oauth.service
;
import
com.jeespring.common.redis.RedisUtils
;
import
com.jeespring.common.utils.IdGen
;
import
com.jeespring.common.web.Result
;
import
com.jeespring.common.web.ResultFactory
;
import
com.jeespring.modules.sys.dao.UserDao
;
import
com.jeespring.modules.sys.entity.SysConfig
;
import
com.jeespring.modules.oauth.entity.TokenInfo
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.SysConfigService
;
import
io.swagger.models.auth.In
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.session.Session
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
@Service
public
class
OauthService
{
@Autowired
private
UserDao
userDao
;
@Autowired
private
SysConfigService
sysConfigService
;
@Autowired
private
RedisUtils
redisUtils
;
public
boolean
isOauthOpen
(){
SysConfig
sysConfigOauth
=
new
SysConfig
();
sysConfigOauth
.
setType
(
"oauthOpen"
);
SysConfig
sysConfigsOauth
=
sysConfigService
.
findListFirstCache
(
sysConfigOauth
);
if
(
"true"
.
equals
(
sysConfigsOauth
.
getValue
()))
{
return
true
;
}
return
false
;
}
public
Result
token
(
String
oauthId
,
String
oauthSecret
,
String
ip
){
if
(
oauthId
==
null
||
oauthSecret
==
null
)
{
return
ResultFactory
.
getErrorResult
(
"授权ID和授权密钥不能为空!"
);
}
String
tokenTime
=
"360000"
;
String
tokenRedis
=
String
.
valueOf
(
redisUtils
.
get
(
oauthId
));
if
(
tokenRedis
!=
null
){
TokenInfo
tokenInfoRedis
=(
TokenInfo
)
redisUtils
.
get
(
tokenRedis
);
redisUtils
.
remove
(
oauthId
);
redisUtils
.
remove
(
tokenInfoRedis
.
getToken
());
redisUtils
.
remove
(
ip
);
redisUtils
.
set
(
tokenInfoRedis
.
getToken
(),
tokenInfoRedis
,
Long
.
valueOf
(
tokenTime
));
redisUtils
.
set
(
oauthId
,
tokenInfoRedis
.
getToken
(),
Long
.
valueOf
(
tokenTime
));
redisUtils
.
set
(
ip
,
tokenInfoRedis
.
getToken
(),
Long
.
valueOf
(
tokenTime
));
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
tokenInfoRedis
);
return
result
;
}
SysConfig
sysConfigTokenTime
=
new
SysConfig
();
sysConfigTokenTime
.
setType
(
"tokenTime"
);
List
<
SysConfig
>
sysConfigsTokenTimes
=
sysConfigService
.
findList
(
sysConfigTokenTime
);
if
(
sysConfigsTokenTimes
.
size
()>
0
){
tokenTime
=
sysConfigsTokenTimes
.
get
(
0
).
getValue
();
}
User
user
=
new
User
();
user
.
setOauthId
(
oauthId
);
user
.
setOauthSecret
(
oauthSecret
);
List
<
User
>
users
=
userDao
.
findList
(
user
);
SysConfig
sysConfigOauthId
=
new
SysConfig
();
sysConfigOauthId
.
setType
(
"oauthId"
);
List
<
SysConfig
>
sysConfigsOauthId
=
sysConfigService
.
findList
(
sysConfigOauthId
);
SysConfig
sysConfigOauthSecret
=
new
SysConfig
();
sysConfigOauthSecret
.
setType
(
"oauthSecret"
);
List
<
SysConfig
>
sysConfigsOauthSecret
=
sysConfigService
.
findList
(
sysConfigOauthSecret
);
if
(
sysConfigsOauthId
.
size
()>
0
&&
sysConfigsOauthSecret
.
size
()>
0
&&
(!
sysConfigsOauthId
.
get
(
0
).
getValue
().
equals
(
oauthId
)
||
!
sysConfigsOauthSecret
.
get
(
0
).
getValue
().
equals
(
oauthSecret
))){
return
ResultFactory
.
getErrorResult
(
"授权ID和授权密钥不正确!"
);
}
if
(
sysConfigsOauthId
.
size
()==
0
&&
sysConfigsOauthSecret
.
size
()==
0
&&
users
.
size
()!=
1
){
return
ResultFactory
.
getErrorResult
(
"授权ID和授权密钥不正确!"
);
}
Result
result
=
ResultFactory
.
getSuccessResult
();
TokenInfo
tokenInfo
=
new
TokenInfo
();
tokenInfo
.
setToken
(
IdGen
.
uuid
());
tokenInfo
.
setTokenDate
(
new
Date
());
tokenInfo
.
setOauthId
(
oauthId
);
tokenInfo
.
setOauthSecret
(
oauthSecret
);
tokenInfo
.
setIp
(
ip
);
result
.
setResultObject
(
tokenInfo
);
redisUtils
.
set
(
tokenInfo
.
getToken
(),
tokenInfo
,
Long
.
valueOf
(
tokenTime
));
redisUtils
.
set
(
oauthId
,
tokenInfo
.
getToken
(),
Long
.
valueOf
(
tokenTime
));
redisUtils
.
set
(
ip
,
tokenInfo
.
getToken
(),
Long
.
valueOf
(
tokenTime
));
return
result
;
}
public
Result
checkToken
(
String
token
,
String
ip
){
String
tokenRedis
=
String
.
valueOf
(
redisUtils
.
get
(
ip
));
if
(
token
==
null
&&
tokenRedis
==
null
){
return
ResultFactory
.
getErrorResult
(
"token不能为空!"
);
}
if
(
token
==
null
&&
tokenRedis
!=
null
){
TokenInfo
tokenInfoRedis
=(
TokenInfo
)
redisUtils
.
get
(
tokenRedis
);
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
tokenInfoRedis
);
return
result
;
}
SysConfig
sysConfigOauth
=
new
SysConfig
();
sysConfigOauth
.
setType
(
"oauthOpen"
);
List
<
SysConfig
>
sysConfigsOauth
=
sysConfigService
.
findList
(
sysConfigOauth
);
if
(
sysConfigsOauth
.
size
()<=
0
){
Result
result
=
ResultFactory
.
getErrorResult
(
"oauth权限服务未开启!"
);
result
.
setResultCode
(
100
);
return
result
;
}
if
(
sysConfigsOauth
.
get
(
0
).
getValue
()==
"false"
){
Result
result
=
ResultFactory
.
getErrorResult
(
"oauth权限服务未开启!"
);
result
.
setResultCode
(
100
);
return
result
;
}
TokenInfo
tokenInfo
=(
TokenInfo
)
redisUtils
.
get
(
token
);
if
(
tokenInfo
==
null
){
return
ResultFactory
.
getErrorResult
(
"Token不正确!"
);
}
Result
result
=
ResultFactory
.
getSuccessResult
();
result
.
setResultObject
(
tokenInfo
);
return
result
;
}
public
Result
userOnlineAmount
(){
SysConfig
userOnlineAmount
=
new
SysConfig
();
userOnlineAmount
.
setType
(
"userOnlineAmount"
);
userOnlineAmount
=
sysConfigService
.
findListFirstCache
(
userOnlineAmount
);
int
countShiro
=
redisUtils
.
getCountShiro
();
Subject
subject
=
SecurityUtils
.
getSubject
();
String
key
=
null
;
if
(
subject
!=
null
&&
subject
.
getSession
()
!=
null
)
{
key
=
redisUtils
.
SHIRO_REDIS
+
":"
+
subject
.
getSession
().
getId
().
toString
();
}
if
(
Integer
.
valueOf
(
userOnlineAmount
.
getValue
())<
countShiro
&&
key
!=
null
){
redisUtils
.
remove
(
key
);
return
ResultFactory
.
getErrorResult
(
"在线控制:在线"
+
countShiro
+
"人/总控制"
+
userOnlineAmount
.
getValue
()+
"人"
);
}
if
(!
redisUtils
.
exists
(
key
)){
return
ResultFactory
.
getErrorResult
(
"在线控制:在线"
+
countShiro
+
"人/总控制"
+
userOnlineAmount
.
getValue
()+
"人"
);
}
return
ResultFactory
.
getSuccessResult
(
"在线控制:在线"
+
countShiro
+
"人/总控制"
+
userOnlineAmount
.
getValue
()+
"人"
);
}
public
Result
getApiTimeLimi
(
String
ip
){
String
redisKey
=
"ApiTimeLimi_"
+
ip
;
SysConfig
apiTimeLimi
=
new
SysConfig
();
apiTimeLimi
.
setType
(
"apiTimeLimi"
);
apiTimeLimi
=
sysConfigService
.
findListFirstCache
(
apiTimeLimi
);
Object
result
=
redisUtils
.
get
(
redisKey
);
if
(
result
==
null
){
return
ResultFactory
.
getSuccessResult
(
"/"
+
apiTimeLimi
.
getValue
());
}
return
ResultFactory
.
getSuccessResult
(
result
+
"/"
+
apiTimeLimi
.
getValue
());
}
public
Result
getApiTime
(){
String
redisKeyDay
=
"ApiTimeDate"
;
String
redisKeyMonth
=
"ApiTimeMonth"
;
Object
apiTimeDay
=
redisUtils
.
get
(
redisKeyDay
);
Object
apiTimeMonth
=
redisUtils
.
get
(
redisKeyMonth
);
if
(
apiTimeDay
==
null
)
{
apiTimeDay
=
"0"
;
}
if
(
apiTimeMonth
==
null
)
{
apiTimeMonth
=
"0"
;
}
return
ResultFactory
.
getSuccessResult
(
"Day:"
+
apiTimeDay
+
" Time;Month:"
+
apiTimeMonth
+
" Time"
);
}
public
Result
setApiTime
(){
String
redisKeyDay
=
"ApiTimeDate"
;
String
redisKeyMonth
=
"ApiTimeMonth"
;
Object
apiTimeDay
=
redisUtils
.
get
(
redisKeyDay
);
Object
apiTimeMonth
=
redisUtils
.
get
(
redisKeyMonth
);
Long
apiTimeDayLong
=
0L
;
Long
apiTimeMonthLong
=
0L
;
if
(
apiTimeDay
==
null
)
{
apiTimeDay
=
0
;
}
if
(
apiTimeMonth
==
null
)
{
apiTimeMonth
=
0
;
}
if
(
apiTimeDay
!=
null
){
apiTimeDayLong
=
Long
.
valueOf
(
apiTimeDay
.
toString
());
apiTimeDayLong
=
apiTimeDayLong
+
1
;
}
if
(
apiTimeMonth
!=
null
){
apiTimeMonthLong
=
Long
.
valueOf
(
apiTimeMonth
.
toString
());
apiTimeMonthLong
=
apiTimeMonthLong
+
1
;
}
redisUtils
.
set
(
redisKeyDay
,
apiTimeDayLong
,
1L
,
TimeUnit
.
DAYS
);
redisUtils
.
set
(
redisKeyMonth
,
apiTimeMonthLong
,
30L
,
TimeUnit
.
DAYS
);
return
ResultFactory
.
getSuccessResult
(
"Day:"
+
apiTimeDayLong
+
" Time;Month:"
+
apiTimeMonthLong
+
" Time"
);
}
public
Result
ApiTimeLimi
(
String
ip
){
String
redisKey
=
"ApiTimeLimi_"
+
ip
;
Object
apiTime
=
redisUtils
.
get
(
redisKey
);
if
(
apiTime
==
null
){
apiTime
=
0
;
}
Object
apiTimeLongRedis
=
redisUtils
.
get
(
redisKey
);
Long
apiTimeLong
=
0L
;
if
(
apiTimeLongRedis
!=
null
){
apiTimeLong
=
Long
.
valueOf
(
apiTimeLongRedis
.
toString
());
}
Long
apiTimeLongSysConfig
=
0L
;
apiTimeLong
+=
1
;
SysConfig
apiTimeLimi
=
new
SysConfig
();
apiTimeLimi
.
setType
(
"apiTimeLimi"
);
List
<
SysConfig
>
apiTimeLimis
=
sysConfigService
.
findList
(
apiTimeLimi
);
if
(
apiTimeLimis
.
size
()>
0
){
apiTimeLongSysConfig
=
Long
.
valueOf
(
apiTimeLimis
.
get
(
0
).
getValue
());
}
if
(
"-1"
.
equals
(
apiTimeLongSysConfig
)){
apiTimeLongSysConfig
=
100000000L
;
}
if
(
apiTimeLimis
.
size
()==
0
){
apiTimeLongSysConfig
=
10000L
;
}
if
(
apiTime
!=
null
&&
apiTimeLongSysConfig
>
apiTimeLong
){
redisUtils
.
remove
(
redisKey
);
}
if
(
apiTimeLongSysConfig
<=
apiTimeLong
){
Result
result
=
ResultFactory
.
getErrorResult
(
"调用失败,接口允许最多调用"
+
apiTimeLongSysConfig
+
"次!"
);
result
.
setResultObject
(
apiTimeLongSysConfig
);
return
result
;
}
redisUtils
.
set
(
redisKey
,
apiTimeLong
);
return
ResultFactory
.
getSuccessResult
();
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/other/package-info.java
0 → 100644
View file @
05beecd0
/**其他的模型都在在这个包下面
* Created by zhao.weiwei
* create on 2017/1/14 22:03
* the email is zhao.weiwei@jyall.com.
*/
package
com.jeespring.modules.other
;
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/pay/pay.txt
0 → 100644
View file @
05beecd0
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/scheduling/JeeSpringScheduledTaskService.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.scheduling
;
import
com.jeespring.common.utils.SendMailUtil
;
//import org.apache.activemq.command.ActiveMQQueue;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
//import javax.jms.Destination;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
//@Service("jeeSpringScheduledTaskService")
@Component
public
class
JeeSpringScheduledTaskService
{
//@Autowired
//private XXXService xxxxService;
private
static
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//@Autowired
//private JeeSpringProducer jeeSpringProducer;
//每个10s执行一次任务
@Scheduled
(
fixedRate
=
600000
)
public
void
run
(){
//xxxxService.method();
//System.out.println(dateFormat.format(new Date()) + " | " + "com.jeespring.modules.scheduling:每隔60s执行一次任务");
}
//每个2s执行一次任务#朝九晚七工作时间内每五分钟
@Scheduled
(
cron
=
"0 0/10 9-19 * * ?"
)
public
void
run2
(){
//System.out.println(dateFormat.format(new Date()) + " | " + "com.jeespring.modules.scheduling:朝九晚七工作时间内每十分钟执行一次任务");
//jeeSpringProducer.sendMessageA( "ActiveMQ JeeSpringProducer queueA。");
//jeeSpringProducer.sendMessageB("ActiveMQ JeeSpringProducer queueB。");
}
//每天15点29分执行该任务
@Scheduled
(
cron
=
"0 29 15 ? * *"
)
public
void
run3
()
{
//System.out.println(dateFormat.format(new Date()) + " | " + "com.jeespring.modules.scheduling:每天在指定时间执行任务");
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/scheduling/JeeSpringTaskSchedulerConfig.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.scheduling
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@Configuration
@ComponentScan
(
"com.jeespring.modules.scheduling"
)
@EnableScheduling
public
class
JeeSpringTaskSchedulerConfig
{
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/server/dao/SysServerDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.server.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.server.entity.SysServer
;
/**
* 服务器监控DAO接口
* @author JeeSpring
* @version 2018-08-20
*/
@Mapper
public
interface
SysServerDao
extends
InterfaceBaseDao
<
SysServer
>
{
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/server/entity/SysServer.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.server.entity
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
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-20
*/
public
class
SysServer
extends
AbstractBaseEntity
<
SysServer
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
serverNumber
;
// 服务器编号
private
String
serverAddress
;
// 服务器监控地址
private
String
name
;
// 名称
private
String
label
;
// 标签名
private
String
picture
;
// 图片
private
String
type
;
// 类型
private
String
typeLabel
;
// 类型Label
private
String
typePicture
;
// 类型Picture
private
Long
sort
;
// 排序(升序)
private
String
description
;
// 描述
private
String
html
;
// 备注信息
private
String
status
;
// 在线状态on_line在线off_line离线
private
String
statusLabel
;
// 在线状态on_line在线off_line离线Label
private
String
statusPicture
;
// 在线状态on_line在线off_line离线Picture
private
java
.
util
.
Date
beginCreateDate
;
// 开始 创建时间
private
java
.
util
.
Date
endCreateDate
;
// 结束 创建时间
private
java
.
util
.
Date
beginUpdateDate
;
// 开始 更新时间
private
java
.
util
.
Date
endUpdateDate
;
// 结束 更新时间
public
SysServer
()
{
super
();
}
public
SysServer
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
255
,
message
=
"服务器编号长度必须介于 0 和 255 之间"
)
@ExcelField
(
title
=
"服务器编号"
,
align
=
2
,
sort
=
1
)
public
String
getServerNumber
()
{
return
serverNumber
;
}
public
void
setServerNumber
(
String
serverNumber
)
{
this
.
serverNumber
=
serverNumber
;
}
@Length
(
min
=
0
,
max
=
100
,
message
=
"服务器监控地址长度必须介于 0 和 100 之间"
)
@ExcelField
(
title
=
"服务器监控地址"
,
align
=
2
,
sort
=
2
)
public
String
getServerAddress
()
{
return
serverAddress
;
}
public
void
setServerAddress
(
String
serverAddress
)
{
this
.
serverAddress
=
serverAddress
;
}
@Length
(
min
=
0
,
max
=
255
,
message
=
"名称长度必须介于 0 和 255 之间"
)
@ExcelField
(
title
=
"名称"
,
align
=
2
,
sort
=
3
)
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@Length
(
min
=
0
,
max
=
50
,
message
=
"标签名长度必须介于 0 和 50 之间"
)
@ExcelField
(
title
=
"标签名"
,
align
=
2
,
sort
=
4
)
public
String
getLabel
()
{
return
label
;
}
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
}
@Length
(
min
=
0
,
max
=
100
,
message
=
"图片长度必须介于 0 和 100 之间"
)
@ExcelField
(
title
=
"图片"
,
align
=
2
,
sort
=
5
)
public
String
getPicture
()
{
return
picture
;
}
public
void
setPicture
(
String
picture
)
{
this
.
picture
=
picture
;
}
@Length
(
min
=
0
,
max
=
50
,
message
=
"类型长度必须介于 0 和 50 之间"
)
@ExcelField
(
title
=
"类型"
,
dictType
=
"server_type"
,
align
=
2
,
sort
=
6
)
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getTypeLabel
()
{
return
DictUtils
.
getDictLabel
(
type
,
"server_type"
,
""
);
}
public
String
getTypePicture
()
{
return
DictUtils
.
getDictPicture
(
type
,
"server_type"
,
""
);
}
@NotNull
(
message
=
"排序(升序)不能为空"
)
@ExcelField
(
title
=
"排序(升序)"
,
align
=
2
,
sort
=
7
)
public
Long
getSort
()
{
return
sort
;
}
public
void
setSort
(
Long
sort
)
{
this
.
sort
=
sort
;
}
@Length
(
min
=
0
,
max
=
100
,
message
=
"描述长度必须介于 0 和 100 之间"
)
@ExcelField
(
title
=
"描述"
,
align
=
2
,
sort
=
8
)
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
@ExcelField
(
title
=
"备注信息"
,
align
=
2
,
sort
=
10
)
public
String
getHtml
()
{
return
html
;
}
public
void
setHtml
(
String
html
)
{
this
.
html
=
html
;
}
@Length
(
min
=
0
,
max
=
10
,
message
=
"在线状态on_line在线off_line离线长度必须介于 0 和 10 之间"
)
@ExcelField
(
title
=
"在线状态on_line在线off_line离线"
,
dictType
=
"on_line_status"
,
align
=
2
,
sort
=
11
)
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatusLabel
()
{
return
DictUtils
.
getDictLabel
(
status
,
"on_line_status"
,
""
);
}
public
String
getStatusPicture
()
{
return
DictUtils
.
getDictPicture
(
status
,
"on_line_status"
,
""
);
}
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
Prev
1
…
11
12
13
14
15
16
17
18
19
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