Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beijing-vehicleflow
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangzhenbang
beijing-vehicleflow
Commits
76ec7b63
Commit
76ec7b63
authored
Feb 24, 2020
by
zhangzhenbang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时30s审批通过
parent
6f1a92e0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
3 deletions
+101
-3
AsyncConfig.java
...va/com/yingxin/beijingvehicleflow/config/AsyncConfig.java
+37
-0
FloatingPopulationController.java
...gvehicleflow/controller/FloatingPopulationController.java
+1
-1
IdentityInfoController.java
...beijingvehicleflow/controller/IdentityInfoController.java
+1
-1
ReservationController.java
.../beijingvehicleflow/controller/ReservationController.java
+1
-1
ReservationMapper.java
.../yingxin/beijingvehicleflow/mapper/ReservationMapper.java
+4
-0
ReservationService.java
...ingxin/beijingvehicleflow/service/ReservationService.java
+2
-0
ScheduleTask.java
.../com/yingxin/beijingvehicleflow/service/ScheduleTask.java
+50
-0
ReservationServiceImpl.java
...ijingvehicleflow/service/impl/ReservationServiceImpl.java
+5
-0
No files found.
src/main/java/com/yingxin/beijingvehicleflow/config/AsyncConfig.java
0 → 100644
View file @
76ec7b63
package
com
.
yingxin
.
beijingvehicleflow
.
config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.task.AsyncTaskExecutor
;
import
org.springframework.scheduling.annotation.AsyncConfigurer
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
/**
* 异步相关定义
*
* @author zhangzhenbang
* @version 1.0
* @date 2020/1/8
*/
@Configuration
public
class
AsyncConfig
implements
AsyncConfigurer
{
@Value
(
"${async-Config.MAX-POOL-SIZE}"
)
private
int
maxPoolSize
;
@Value
(
"${async-Config.CORE-POOL-SIZE}"
)
private
int
corePoolSize
;
@Bean
(
"asyncTaskExecutor"
)
public
AsyncTaskExecutor
asyncTaskExecutor
()
{
ThreadPoolTaskExecutor
asyncTaskExecutor
=
new
ThreadPoolTaskExecutor
();
asyncTaskExecutor
.
setMaxPoolSize
(
maxPoolSize
);
asyncTaskExecutor
.
setCorePoolSize
(
corePoolSize
);
asyncTaskExecutor
.
setThreadNamePrefix
(
"async-task-thread-pool-"
);
asyncTaskExecutor
.
initialize
();
return
asyncTaskExecutor
;
}
}
src/main/java/com/yingxin/beijingvehicleflow/controller/FloatingPopulationController.java
View file @
76ec7b63
...
...
@@ -19,7 +19,7 @@ import java.util.Date;
*/
@RestController
@CrossOrigin
@RequestMapping
(
"/api/v1"
)
@RequestMapping
(
"/
bj
api/v1"
)
public
class
FloatingPopulationController
{
@Autowired
...
...
src/main/java/com/yingxin/beijingvehicleflow/controller/IdentityInfoController.java
View file @
76ec7b63
...
...
@@ -33,7 +33,7 @@ import java.util.List;
*/
@RestController
@CrossOrigin
@RequestMapping
(
"/api/v1"
)
@RequestMapping
(
"/
bj
api/v1"
)
public
class
IdentityInfoController
{
private
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
IdentityInfoController
.
class
);
...
...
src/main/java/com/yingxin/beijingvehicleflow/controller/ReservationController.java
View file @
76ec7b63
...
...
@@ -21,7 +21,7 @@ import java.util.List;
*/
@RestController
@CrossOrigin
@RequestMapping
(
"/api/v1"
)
@RequestMapping
(
"/
bj
api/v1"
)
public
class
ReservationController
{
private
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ReservationController
.
class
);
...
...
src/main/java/com/yingxin/beijingvehicleflow/mapper/ReservationMapper.java
View file @
76ec7b63
...
...
@@ -42,4 +42,8 @@ public interface ReservationMapper {
@Select
(
"select * from reservation where verify_state=0 and identity_id=#{id}"
)
List
<
Reservation
>
selectNotVerifyReservatinsByIdentityId
(
IdentityInformation
info
);
@Update
(
"update reservation set verify_state=1"
)
int
updateAllVerifyState
();
}
src/main/java/com/yingxin/beijingvehicleflow/service/ReservationService.java
View file @
76ec7b63
...
...
@@ -23,4 +23,6 @@ public interface ReservationService {
boolean
isUpdateAuthInfoSucc
(
Reservation
reservation
);
List
<
Reservation
>
selectNotVerifyReservatinsByIdentityId
(
IdentityInformation
info
);
int
updateAllVerifyState
();
}
src/main/java/com/yingxin/beijingvehicleflow/service/ScheduleTask.java
0 → 100644
View file @
76ec7b63
package
com
.
yingxin
.
beijingvehicleflow
.
service
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* 月初更新信息修改次数
*
* @author 226
* @version 1.0
* @date 2020/2/19
*/
@Component
@EnableScheduling
@EnableAsync
public
class
ScheduleTask
{
private
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ScheduleTask
.
class
);
@Autowired
private
ReservationService
reservationService
;
/**
* 定时任务
*
* 表达式有六位,秒、分、时、日、月、星期
* 下面表示每个月的一号执行定时任务
*
* @date 2020/2/19
*/
@Async
(
"asyncTaskExecutor"
)
@Scheduled
(
cron
=
"*/30 * * * * ?"
)
public
void
tasks
()
{
try
{
reservationService
.
updateAllVerifyState
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"异步认证次数发放异常:"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/yingxin/beijingvehicleflow/service/impl/ReservationServiceImpl.java
View file @
76ec7b63
...
...
@@ -83,4 +83,9 @@ public class ReservationServiceImpl implements ReservationService {
public
List
<
Reservation
>
selectNotVerifyReservatinsByIdentityId
(
IdentityInformation
info
)
{
return
reservationMapper
.
selectNotVerifyReservatinsByIdentityId
(
info
);
}
@Override
public
int
updateAllVerifyState
()
{
return
reservationMapper
.
updateAllVerifyState
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment