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
Eladmin
Commits
8c4fd97e
"src/vscode:/vscode.git/clone" did not exist on "be9263c0029c209ea275ce6062c1e02f8e930452"
Commit
8c4fd97e
authored
Jan 20, 2019
by
郑杰
Browse files
v1.5 beta版发布,详细查看发行版说明
parent
b066bb99
Changes
198
Show whitespace changes
Inline
Side-by-side
src/main/java/me/zhengjie/monitor/config/VisitsInitialization.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/config/VisitsInitialization.java
View file @
8c4fd97e
package
me.zhengjie.monitor.config
;
package
me.zhengjie.
modules.
monitor.config
;
import
me.zhengjie.monitor.service.VisitsService
;
import
me.zhengjie.
modules.
monitor.service.VisitsService
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
/**
/**
...
@@ -13,5 +13,6 @@ public class VisitsInitialization {
...
@@ -13,5 +13,6 @@ public class VisitsInitialization {
public
VisitsInitialization
(
VisitsService
visitsService
){
public
VisitsInitialization
(
VisitsService
visitsService
){
System
.
out
.
println
(
"--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------"
);
System
.
out
.
println
(
"--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------"
);
visitsService
.
save
();
visitsService
.
save
();
System
.
out
.
println
(
"--------------- 初始化站点统计完成 ---------------"
);
}
}
}
}
src/main/java/me/zhengjie/monitor/config/WebSocketConfig.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/config/WebSocketConfig.java
View file @
8c4fd97e
package
me.zhengjie.monitor.config
;
package
me.zhengjie.
modules.
monitor.config
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.monitor.domain.LogMessage
;
import
me.zhengjie.
modules.
monitor.domain.LogMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.messaging.simp.SimpMessagingTemplate
;
import
org.springframework.messaging.simp.SimpMessagingTemplate
;
import
org.springframework.web.socket.config.annotation.StompEndpointRegistry
;
import
org.springframework.web.socket.config.annotation.StompEndpointRegistry
;
import
org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
;
import
org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.util.concurrent.
*
;
import
java.util.concurrent.
ExecutorService
;
/**
/**
* 配置WebSocket消息代理端点,即stomp服务端
* 配置WebSocket消息代理端点,即stomp服务端
...
...
src/main/java/me/zhengjie/monitor/domain/LogMessage.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/domain/LogMessage.java
View file @
8c4fd97e
package
me.zhengjie.monitor.domain
;
package
me.zhengjie.
modules.
monitor.domain
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
...
src/main/java/me/zhengjie/monitor/domain/Visits.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/domain/Visits.java
View file @
8c4fd97e
package
me.zhengjie.monitor.domain
;
package
me.zhengjie.
modules.
monitor.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
...
@@ -31,7 +31,9 @@ public class Visits {
...
@@ -31,7 +31,9 @@ public class Visits {
private
Long
ipCounts
;
private
Long
ipCounts
;
@CreationTimestamp
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
private
Timestamp
createTime
;
@Column
(
name
=
"week_day"
)
private
String
weekDay
;
private
String
weekDay
;
}
}
src/main/java/me/zhengjie/monitor/domain/vo/RedisVo.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/domain/vo/RedisVo.java
View file @
8c4fd97e
package
me.zhengjie.monitor.domain.vo
;
package
me.zhengjie.
modules.
monitor.domain.vo
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
...
src/main/java/me/zhengjie/monitor/repository/VisitsRepository.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/repository/VisitsRepository.java
View file @
8c4fd97e
package
me.zhengjie.monitor.repository
;
package
me.zhengjie.
modules.
monitor.repository
;
import
me.zhengjie.monitor.domain.Visits
;
import
me.zhengjie.
modules.
monitor.domain.Visits
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -29,6 +28,6 @@ public interface VisitsRepository extends JpaRepository<Visits,Long> {
...
@@ -29,6 +28,6 @@ public interface VisitsRepository extends JpaRepository<Visits,Long> {
* @return
* @return
*/
*/
@Query
(
value
=
"select * FROM visits where "
+
@Query
(
value
=
"select * FROM visits where "
+
"create
T
ime between ?1 and ?2"
,
nativeQuery
=
true
)
"create
_t
ime between ?1 and ?2"
,
nativeQuery
=
true
)
List
<
Visits
>
findAllVisits
(
String
date1
,
String
date2
);
List
<
Visits
>
findAllVisits
(
String
date1
,
String
date2
);
}
}
src/main/java/me/zhengjie/monitor/rest/
Tes
tController.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/rest/
Limi
tController.java
View file @
8c4fd97e
package
me.zhengjie.monitor.rest
;
package
me.zhengjie.
modules.
monitor.rest
;
import
me.zhengjie.common.aop.limit.Limit
;
import
me.zhengjie.aop.limit.Limit
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
*
* 接口限流测试类
*/
@RestController
@RestController
@RequestMapping
(
"
test
"
)
@RequestMapping
(
"
api
"
)
public
class
Tes
tController
{
public
class
Limi
tController
{
private
static
final
AtomicInteger
ATOMIC_INTEGER
=
new
AtomicInteger
();
private
static
final
AtomicInteger
ATOMIC_INTEGER
=
new
AtomicInteger
();
/**
/**
* 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test,
* 测试限流注解,下面配置说明该接口 60秒内最多只能访问 10次,保存到redis的键名为 limit_test,
*/
*/
@Limit
(
key
=
"test"
,
period
=
60
,
count
=
10
,
name
=
"testLimit"
,
prefix
=
"limit"
)
@Limit
(
key
=
"test"
,
period
=
60
,
count
=
10
,
name
=
"testLimit"
,
prefix
=
"limit"
)
@GetMapping
(
"limit"
)
@GetMapping
(
"
/
limit"
)
public
int
testLimit
()
{
public
int
testLimit
()
{
return
ATOMIC_INTEGER
.
incrementAndGet
();
return
ATOMIC_INTEGER
.
incrementAndGet
();
}
}
...
...
src/main/java/me/zhengjie/monitor/rest/RedisController.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/rest/RedisController.java
View file @
8c4fd97e
package
me.zhengjie.monitor.rest
;
package
me.zhengjie.
modules.
monitor.rest
;
import
me.zhengjie.
common.
aop.log.Log
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.monitor.domain.vo.RedisVo
;
import
me.zhengjie.
modules.
monitor.domain.vo.RedisVo
;
import
me.zhengjie.monitor.service.RedisService
;
import
me.zhengjie.
modules.
monitor.service.RedisService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -22,14 +22,14 @@ public class RedisController {
...
@@ -22,14 +22,14 @@ public class RedisController {
@Autowired
@Autowired
private
RedisService
redisService
;
private
RedisService
redisService
;
@Log
(
description
=
"查询Redis缓存"
)
@Log
(
"查询Redis缓存"
)
@GetMapping
(
value
=
"/redis"
)
@GetMapping
(
value
=
"/redis"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_SELECT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_SELECT')"
)
public
ResponseEntity
getRedis
(
String
key
,
Pageable
pageable
){
public
ResponseEntity
getRedis
(
String
key
,
Pageable
pageable
){
return
new
ResponseEntity
(
redisService
.
findByKey
(
key
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
(
redisService
.
findByKey
(
key
,
pageable
),
HttpStatus
.
OK
);
}
}
@Log
(
description
=
"新增Redis缓存"
)
@Log
(
"新增Redis缓存"
)
@PostMapping
(
value
=
"/redis"
)
@PostMapping
(
value
=
"/redis"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_CREATE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_CREATE')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
RedisVo
resources
){
public
ResponseEntity
create
(
@Validated
@RequestBody
RedisVo
resources
){
...
@@ -37,7 +37,7 @@ public class RedisController {
...
@@ -37,7 +37,7 @@ public class RedisController {
return
new
ResponseEntity
(
HttpStatus
.
CREATED
);
return
new
ResponseEntity
(
HttpStatus
.
CREATED
);
}
}
@Log
(
description
=
"修改Redis缓存"
)
@Log
(
"修改Redis缓存"
)
@PutMapping
(
value
=
"/redis"
)
@PutMapping
(
value
=
"/redis"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_EDIT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_EDIT')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
RedisVo
resources
){
public
ResponseEntity
update
(
@Validated
@RequestBody
RedisVo
resources
){
...
@@ -45,7 +45,7 @@ public class RedisController {
...
@@ -45,7 +45,7 @@ public class RedisController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
}
@Log
(
description
=
"删除Redis缓存"
)
@Log
(
"删除Redis缓存"
)
@DeleteMapping
(
value
=
"/redis"
)
@DeleteMapping
(
value
=
"/redis"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')"
)
public
ResponseEntity
delete
(
@RequestBody
RedisVo
resources
){
public
ResponseEntity
delete
(
@RequestBody
RedisVo
resources
){
...
@@ -53,7 +53,7 @@ public class RedisController {
...
@@ -53,7 +53,7 @@ public class RedisController {
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
@Log
(
description
=
"清空Redis缓存"
)
@Log
(
"清空Redis缓存"
)
@DeleteMapping
(
value
=
"/redis/all"
)
@DeleteMapping
(
value
=
"/redis/all"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')"
)
public
ResponseEntity
deleteAll
(){
public
ResponseEntity
deleteAll
(){
...
...
src/main/java/me/zhengjie/monitor/rest/VisitsController.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/rest/VisitsController.java
View file @
8c4fd97e
package
me.zhengjie.monitor.rest
;
package
me.zhengjie.
modules.
monitor.rest
;
import
me.zhengjie.
common.utils.RequestHolder
;
import
me.zhengjie.
modules.monitor.service.VisitsService
;
import
me.zhengjie.
monitor.service.VisitsService
;
import
me.zhengjie.
utils.RequestHolder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
...
src/main/java/me/zhengjie/monitor/service/RedisService.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/service/RedisService.java
View file @
8c4fd97e
package
me.zhengjie.monitor.service
;
package
me.zhengjie.
modules.
monitor.service
;
import
me.zhengjie.monitor.domain.vo.RedisVo
;
import
me.zhengjie.
modules.
monitor.domain.vo.RedisVo
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
...
src/main/java/me/zhengjie/monitor/service/VisitsService.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/service/VisitsService.java
View file @
8c4fd97e
package
me.zhengjie.monitor.service
;
package
me.zhengjie.
modules.
monitor.service
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
...
...
src/main/java/me/zhengjie/monitor/service/impl/RedisServiceImpl.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/service/impl/RedisServiceImpl.java
View file @
8c4fd97e
package
me.zhengjie.monitor.service.impl
;
package
me.zhengjie.
modules.
monitor.service.impl
;
import
me.zhengjie.
common.utils.PageUtil
;
import
me.zhengjie.
modules.monitor.domain.vo.RedisVo
;
import
me.zhengjie.mo
nitor.domain.vo.RedisVo
;
import
me.zhengjie.mo
dules.monitor.service.RedisService
;
import
me.zhengjie.
monitor.service.RedisService
;
import
me.zhengjie.
utils.PageUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageImpl
;
...
@@ -10,7 +10,8 @@ import org.springframework.data.domain.Pageable;
...
@@ -10,7 +10,8 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisPool
;
import
redis.clients.jedis.JedisPool
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @author jie
* @author jie
...
...
src/main/java/me/zhengjie/monitor/service/impl/VisitsServiceImpl.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
monitor/service/impl/VisitsServiceImpl.java
View file @
8c4fd97e
package
me.zhengjie.monitor.service.impl
;
package
me.zhengjie.
modules.
monitor.service.impl
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.
common.utils.TimeUtil
;
import
me.zhengjie.
modules.monitor.domain.Visits
;
import
me.zhengjie.mo
nitor.domain.Visits
;
import
me.zhengjie.mo
dules.monitor.repository.VisitsRepository
;
import
me.zhengjie.mo
nitor.repository.LoggingRepository
;
import
me.zhengjie.mo
dules.monitor.service.VisitsService
;
import
me.zhengjie.
monitor.
repository.
Visits
Repository
;
import
me.zhengjie.repository.
Log
Repository
;
import
me.zhengjie.
monitor.service.VisitsService
;
import
me.zhengjie.
utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
...
@@ -30,7 +30,7 @@ public class VisitsServiceImpl implements VisitsService {
...
@@ -30,7 +30,7 @@ public class VisitsServiceImpl implements VisitsService {
private
VisitsRepository
visitsRepository
;
private
VisitsRepository
visitsRepository
;
@Autowired
@Autowired
private
Log
ging
Repository
log
ging
Repository
;
private
LogRepository
logRepository
;
@Override
@Override
public
void
save
()
{
public
void
save
()
{
...
@@ -38,7 +38,7 @@ public class VisitsServiceImpl implements VisitsService {
...
@@ -38,7 +38,7 @@ public class VisitsServiceImpl implements VisitsService {
Visits
visits
=
visitsRepository
.
findByDate
(
localDate
.
toString
());
Visits
visits
=
visitsRepository
.
findByDate
(
localDate
.
toString
());
if
(
visits
==
null
){
if
(
visits
==
null
){
visits
=
new
Visits
();
visits
=
new
Visits
();
visits
.
setWeekDay
(
Time
Util
.
getWeekDay
());
visits
.
setWeekDay
(
String
Util
s
.
getWeekDay
());
visits
.
setPvCounts
(
1L
);
visits
.
setPvCounts
(
1L
);
visits
.
setIpCounts
(
1L
);
visits
.
setIpCounts
(
1L
);
visits
.
setDate
(
localDate
.
toString
());
visits
.
setDate
(
localDate
.
toString
());
...
@@ -51,7 +51,7 @@ public class VisitsServiceImpl implements VisitsService {
...
@@ -51,7 +51,7 @@ public class VisitsServiceImpl implements VisitsService {
LocalDate
localDate
=
LocalDate
.
now
();
LocalDate
localDate
=
LocalDate
.
now
();
Visits
visits
=
visitsRepository
.
findByDate
(
localDate
.
toString
());
Visits
visits
=
visitsRepository
.
findByDate
(
localDate
.
toString
());
visits
.
setPvCounts
(
visits
.
getPvCounts
()+
1
);
visits
.
setPvCounts
(
visits
.
getPvCounts
()+
1
);
long
ipCounts
=
log
ging
Repository
.
findIp
(
localDate
.
toString
(),
localDate
.
plusDays
(
1
).
toString
());
long
ipCounts
=
logRepository
.
findIp
(
localDate
.
toString
(),
localDate
.
plusDays
(
1
).
toString
());
visits
.
setIpCounts
(
ipCounts
);
visits
.
setIpCounts
(
ipCounts
);
visitsRepository
.
save
(
visits
);
visitsRepository
.
save
(
visits
);
}
}
...
...
src/main/java/me/zhengjie/quartz/config/JobRunner.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/config/JobRunner.java
View file @
8c4fd97e
package
me.zhengjie.quartz.config
;
package
me.zhengjie.
modules.
quartz.config
;
import
me.zhengjie.quartz.domain.QuartzJob
;
import
me.zhengjie.
modules.
quartz.domain.QuartzJob
;
import
me.zhengjie.quartz.repository.QuartzJobRepository
;
import
me.zhengjie.
modules.
quartz.repository.QuartzJobRepository
;
import
me.zhengjie.quartz.utils.QuartzManage
;
import
me.zhengjie.
modules.
quartz.utils.QuartzManage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.boot.ApplicationRunner
;
...
...
src/main/java/me/zhengjie/quartz/config/QuartzConfig.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/config/QuartzConfig.java
View file @
8c4fd97e
package
me.zhengjie.quartz.config
;
package
me.zhengjie.
modules.
quartz.config
;
import
org.quartz.Scheduler
;
import
org.quartz.Scheduler
;
import
org.quartz.spi.TriggerFiredBundle
;
import
org.quartz.spi.TriggerFiredBundle
;
...
...
src/main/java/me/zhengjie/quartz/domain/QuartzJob.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/domain/QuartzJob.java
View file @
8c4fd97e
package
me.zhengjie.quartz.domain
;
package
me.zhengjie.
modules.
quartz.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
org.hibernate.annotations.UpdateTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -25,6 +26,7 @@ public class QuartzJob implements Serializable {
...
@@ -25,6 +26,7 @@ public class QuartzJob implements Serializable {
/**
/**
* 定时器名称
* 定时器名称
*/
*/
@Column
(
name
=
"job_name"
)
private
String
jobName
;
private
String
jobName
;
/**
/**
...
@@ -71,5 +73,6 @@ public class QuartzJob implements Serializable {
...
@@ -71,5 +73,6 @@ public class QuartzJob implements Serializable {
* 创建日期
* 创建日期
*/
*/
@UpdateTimestamp
@UpdateTimestamp
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
private
Timestamp
updateTime
;
}
}
\ No newline at end of file
src/main/java/me/zhengjie/quartz/domain/QuartzLog.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/domain/QuartzLog.java
View file @
8c4fd97e
package
me.zhengjie.quartz.domain
;
package
me.zhengjie.
modules.
quartz.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.CreationTimestamp
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
...
@@ -58,7 +59,7 @@ public class QuartzLog implements Serializable {
...
@@ -58,7 +59,7 @@ public class QuartzLog implements Serializable {
/**
/**
* 异常详细
* 异常详细
*/
*/
@Column
(
columnDefinition
=
"text"
)
@Column
(
name
=
"exception_detail"
,
columnDefinition
=
"text"
)
private
String
exceptionDetail
;
private
String
exceptionDetail
;
/**
/**
...
@@ -70,5 +71,6 @@ public class QuartzLog implements Serializable {
...
@@ -70,5 +71,6 @@ public class QuartzLog implements Serializable {
* 创建日期
* 创建日期
*/
*/
@CreationTimestamp
@CreationTimestamp
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
private
Timestamp
createTime
;
}
}
src/main/java/me/zhengjie/quartz/repository/QuartzJobRepository.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/repository/QuartzJobRepository.java
View file @
8c4fd97e
package
me.zhengjie.quartz.repository
;
package
me.zhengjie.
modules.
quartz.repository
;
import
me.zhengjie.quartz.domain.QuartzJob
;
import
me.zhengjie.
modules.
quartz.domain.QuartzJob
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Modifying
;
...
...
src/main/java/me/zhengjie/quartz/repository/QuartzLogRepository.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/repository/QuartzLogRepository.java
View file @
8c4fd97e
package
me.zhengjie.quartz.repository
;
package
me.zhengjie.
modules.
quartz.repository
;
import
me.zhengjie.quartz.domain.QuartzLog
;
import
me.zhengjie.
modules.
quartz.domain.QuartzLog
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
...
...
src/main/java/me/zhengjie/quartz/rest/QuartzJobController.java
→
eladmin-system/
src/main/java/me/zhengjie/
modules/
quartz/rest/QuartzJobController.java
View file @
8c4fd97e
package
me.zhengjie.quartz.rest
;
package
me.zhengjie.
modules.
quartz.rest
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.
common.
aop.log.Log
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.
common.
exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.quartz.domain.QuartzJob
;
import
me.zhengjie.
modules.
quartz.domain.QuartzJob
;
import
me.zhengjie.quartz.domain.QuartzLog
;
import
me.zhengjie.
modules.
quartz.domain.QuartzLog
;
import
me.zhengjie.quartz.service.QuartzJobService
;
import
me.zhengjie.
modules.
quartz.service.QuartzJobService
;
import
me.zhengjie.quartz.service.query.QuartzJobQueryService
;
import
me.zhengjie.
modules.
quartz.service.query.QuartzJobQueryService
;
import
me.zhengjie.quartz.service.query.QuartzLogQueryService
;
import
me.zhengjie.
modules.
quartz.service.query.QuartzLogQueryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -36,7 +36,7 @@ public class QuartzJobController {
...
@@ -36,7 +36,7 @@ public class QuartzJobController {
@Autowired
@Autowired
private
QuartzLogQueryService
quartzLogQueryService
;
private
QuartzLogQueryService
quartzLogQueryService
;
@Log
(
description
=
"查询定时任务"
)
@Log
(
"查询定时任务"
)
@GetMapping
(
value
=
"/jobs"
)
@GetMapping
(
value
=
"/jobs"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_SELECT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_SELECT')"
)
public
ResponseEntity
getJobs
(
QuartzJob
resources
,
Pageable
pageable
){
public
ResponseEntity
getJobs
(
QuartzJob
resources
,
Pageable
pageable
){
...
@@ -55,7 +55,7 @@ public class QuartzJobController {
...
@@ -55,7 +55,7 @@ public class QuartzJobController {
return
new
ResponseEntity
(
quartzLogQueryService
.
queryAll
(
resources
,
pageable
),
HttpStatus
.
OK
);
return
new
ResponseEntity
(
quartzLogQueryService
.
queryAll
(
resources
,
pageable
),
HttpStatus
.
OK
);
}
}
@Log
(
description
=
"新增定时任务"
)
@Log
(
"新增定时任务"
)
@PostMapping
(
value
=
"/jobs"
)
@PostMapping
(
value
=
"/jobs"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_CREATE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_CREATE')"
)
public
ResponseEntity
create
(
@Validated
@RequestBody
QuartzJob
resources
){
public
ResponseEntity
create
(
@Validated
@RequestBody
QuartzJob
resources
){
...
@@ -65,7 +65,7 @@ public class QuartzJobController {
...
@@ -65,7 +65,7 @@ public class QuartzJobController {
return
new
ResponseEntity
(
quartzJobService
.
create
(
resources
),
HttpStatus
.
CREATED
);
return
new
ResponseEntity
(
quartzJobService
.
create
(
resources
),
HttpStatus
.
CREATED
);
}
}
@Log
(
description
=
"修改定时任务"
)
@Log
(
"修改定时任务"
)
@PutMapping
(
value
=
"/jobs"
)
@PutMapping
(
value
=
"/jobs"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
public
ResponseEntity
update
(
@Validated
@RequestBody
QuartzJob
resources
){
public
ResponseEntity
update
(
@Validated
@RequestBody
QuartzJob
resources
){
...
@@ -76,7 +76,7 @@ public class QuartzJobController {
...
@@ -76,7 +76,7 @@ public class QuartzJobController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
}
@Log
(
description
=
"更改定时任务状态"
)
@Log
(
"更改定时任务状态"
)
@PutMapping
(
value
=
"/jobs/{id}"
)
@PutMapping
(
value
=
"/jobs/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
public
ResponseEntity
updateIsPause
(
@PathVariable
Long
id
){
public
ResponseEntity
updateIsPause
(
@PathVariable
Long
id
){
...
@@ -84,7 +84,7 @@ public class QuartzJobController {
...
@@ -84,7 +84,7 @@ public class QuartzJobController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
}
@Log
(
description
=
"执行定时任务"
)
@Log
(
"执行定时任务"
)
@PutMapping
(
value
=
"/jobs/exec/{id}"
)
@PutMapping
(
value
=
"/jobs/exec/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')"
)
public
ResponseEntity
execution
(
@PathVariable
Long
id
){
public
ResponseEntity
execution
(
@PathVariable
Long
id
){
...
@@ -92,7 +92,7 @@ public class QuartzJobController {
...
@@ -92,7 +92,7 @@ public class QuartzJobController {
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
return
new
ResponseEntity
(
HttpStatus
.
NO_CONTENT
);
}
}
@Log
(
description
=
"删除定时任务"
)
@Log
(
"删除定时任务"
)
@DeleteMapping
(
value
=
"/jobs/{id}"
)
@DeleteMapping
(
value
=
"/jobs/{id}"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_DELETE')"
)
@PreAuthorize
(
"hasAnyRole('ADMIN','JOB_ALL','JOB_DELETE')"
)
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
public
ResponseEntity
delete
(
@PathVariable
Long
id
){
...
...
Prev
1
2
3
4
5
6
7
8
…
10
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