Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
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
hubin
long-tern-care-service
Commits
a27ca066
Commit
a27ca066
authored
Mar 16, 2023
by
zhangwanglin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务补发
parent
34a023c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
17 deletions
+18
-17
SrvTaskController.java
...hungraim/ltc/governance/controller/SrvTaskController.java
+6
-5
SrvTaskScheduledController.java
...ltc/governance/controller/SrvTaskScheduledController.java
+3
-1
SrvTaskService.java
...a/com/hungraim/ltc/governance/service/SrvTaskService.java
+1
-1
SrvTaskServiceImpl.java
...graim/ltc/governance/service/impl/SrvTaskServiceImpl.java
+8
-10
No files found.
governance/src/main/java/com/hungraim/ltc/governance/controller/SrvTaskController.java
View file @
a27ca066
...
@@ -2,8 +2,6 @@ package com.hungraim.ltc.governance.controller;
...
@@ -2,8 +2,6 @@ package com.hungraim.ltc.governance.controller;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.governance.service.SrvTaskService
;
import
com.hungraim.ltc.governance.service.SrvTaskService
;
import
com.hungraim.ltc.pojo.vo.account.SrvTaskReqVO
;
import
com.hungraim.ltc.pojo.vo.account.SrvTaskRespVO
;
import
com.hungraim.ltc.pojo.vo.governance.*
;
import
com.hungraim.ltc.pojo.vo.governance.*
;
import
com.hungraim.ltc.util.Result
;
import
com.hungraim.ltc.util.Result
;
import
com.hungraim.ltc.util.ResultCode
;
import
com.hungraim.ltc.util.ResultCode
;
...
@@ -11,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -11,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -149,8 +146,12 @@ public class SrvTaskController {
...
@@ -149,8 +146,12 @@ public class SrvTaskController {
* 根据计划开始时间每天执行当天计划
* 根据计划开始时间每天执行当天计划
**/
**/
@GetMapping
(
"timeAllocationSrvTask"
)
@GetMapping
(
"timeAllocationSrvTask"
)
public
void
timeAllocationSrvTask
()
{
public
Result
timeAllocationSrvTask
(
String
dateStr
)
{
srvTaskService
.
timeAllocationSrvTask
();
if
(
StringUtils
.
isEmpty
(
dateStr
))
{
return
Result
.
failed
(
ResultCode
.
REQUEST_PARAM_ERROR
);
}
srvTaskService
.
timeAllocationSrvTask
(
dateStr
);
return
Result
.
success
();
}
}
}
}
governance/src/main/java/com/hungraim/ltc/governance/controller/SrvTaskScheduledController.java
View file @
a27ca066
package
com
.
hungraim
.
ltc
.
governance
.
controller
;
package
com
.
hungraim
.
ltc
.
governance
.
controller
;
import
com.hungraim.ltc.governance.service.SrvTaskService
;
import
com.hungraim.ltc.governance.service.SrvTaskService
;
import
com.hungraim.ltc.util.DateUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
...
@@ -24,7 +25,8 @@ public class SrvTaskScheduledController {
...
@@ -24,7 +25,8 @@ public class SrvTaskScheduledController {
@Scheduled
(
cron
=
"0 50 20 * * ?"
)
@Scheduled
(
cron
=
"0 50 20 * * ?"
)
public
void
timeAllocationSrvTask
()
{
public
void
timeAllocationSrvTask
()
{
log
.
info
(
"timeAllocationSrvTask========start"
);
log
.
info
(
"timeAllocationSrvTask========start"
);
srvTaskService
.
timeAllocationSrvTask
();
String
nextDay
=
DateUtils
.
getNextDay
();
srvTaskService
.
timeAllocationSrvTask
(
nextDay
);
log
.
info
(
"timeAllocationSrvTask========end:{}"
);
log
.
info
(
"timeAllocationSrvTask========end:{}"
);
}
}
...
...
governance/src/main/java/com/hungraim/ltc/governance/service/SrvTaskService.java
View file @
a27ca066
...
@@ -33,6 +33,6 @@ public interface SrvTaskService {
...
@@ -33,6 +33,6 @@ public interface SrvTaskService {
void
addOrUpdateSrvTask
(
SrvTaskInfoListVO
param
);
void
addOrUpdateSrvTask
(
SrvTaskInfoListVO
param
);
void
timeAllocationSrvTask
();
void
timeAllocationSrvTask
(
String
dateStr
);
}
}
governance/src/main/java/com/hungraim/ltc/governance/service/impl/SrvTaskServiceImpl.java
View file @
a27ca066
...
@@ -23,11 +23,9 @@ import com.hungraim.ltc.util.AttachType;
...
@@ -23,11 +23,9 @@ import com.hungraim.ltc.util.AttachType;
import
com.hungraim.ltc.util.DateUtils
;
import
com.hungraim.ltc.util.DateUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -211,7 +209,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
...
@@ -211,7 +209,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
@Override
@Override
public
void
timeAllocationSrvTask
()
{
public
void
timeAllocationSrvTask
(
String
dateStr
)
{
List
<
ChSrvProgram
>
programEndProgram
=
chSrvProgramMapper
.
getProgramEndProgram
();
List
<
ChSrvProgram
>
programEndProgram
=
chSrvProgramMapper
.
getProgramEndProgram
();
if
(
CollectionUtil
.
isNotEmpty
(
programEndProgram
))
{
if
(
CollectionUtil
.
isNotEmpty
(
programEndProgram
))
{
for
(
ChSrvProgram
chSrvProgram
:
programEndProgram
)
{
for
(
ChSrvProgram
chSrvProgram
:
programEndProgram
)
{
...
@@ -227,28 +225,28 @@ public class SrvTaskServiceImpl implements SrvTaskService {
...
@@ -227,28 +225,28 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvSendMapper
.
updateSrvSendInfo
(
disabInfoId
);
chSrvSendMapper
.
updateSrvSendInfo
(
disabInfoId
);
}
}
}
}
// 查询需要执行的计划
// 查询需要执行的计划
List
<
AllocationSrvTaskVO
>
chSrvTasks
=
srvTaskMapper
.
getAllocationSrvTask
();
List
<
AllocationSrvTaskVO
>
chSrvTasks
=
srvTaskMapper
.
getAllocationSrvTask
();
// 生成计划任务 CH_SRV_TASK_DETAIL
// 生成计划任务 CH_SRV_TASK_DETAIL
for
(
AllocationSrvTaskVO
chSrvTask
:
chSrvTasks
)
{
for
(
AllocationSrvTaskVO
chSrvTask
:
chSrvTasks
)
{
Long
srvTaskId
=
chSrvTask
.
getSrvTaskId
();
Long
srvTaskId
=
chSrvTask
.
getSrvTaskId
();
String
nextDay
=
DateUtils
.
getNextDay
();
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
int
chSrvTaskDetailCount
=
chSrvTaskDetailMapper
int
chSrvTaskDetailCount
=
chSrvTaskDetailMapper
.
getSrvTaskDetail
(
String
.
valueOf
(
srvTaskId
),
nextDay
);
.
getSrvTaskDetail
(
String
.
valueOf
(
srvTaskId
),
dateStr
);
if
(
chSrvTaskDetailCount
>
0
)
{
if
(
chSrvTaskDetailCount
>
0
)
{
log
.
info
(
"{},已经有计划任务了"
,
nextDay
);
log
.
info
(
"{},已经有计划任务了"
,
dateStr
);
return
;
continue
;
}
}
ChSrvTaskDetail
chSrvTaskDetail
=
new
ChSrvTaskDetail
();
ChSrvTaskDetail
chSrvTaskDetail
=
new
ChSrvTaskDetail
();
chSrvTaskDetail
.
setSrvTaskId
(
srvTaskId
);
//taskId
chSrvTaskDetail
.
setSrvTaskId
(
srvTaskId
);
//taskId
chSrvTaskDetail
.
setSrvDate
(
DateUtils
.
strToDate
(
nextDay
));
//服务开始时间
chSrvTaskDetail
.
setSrvDate
(
DateUtils
.
strToDate
(
dateStr
));
//服务开始时间
chSrvTaskDetail
.
setStatus
((
short
)
0
);
//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetail
.
setStatus
((
short
)
0
);
//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetailMapper
.
insert
(
chSrvTaskDetail
);
chSrvTaskDetailMapper
.
insert
(
chSrvTaskDetail
);
// ch_srv_plan
// ch_srv_plan
String
programId
=
chSrvTask
.
getProgramId
();
String
programId
=
chSrvTask
.
getProgramId
();
saveSrvPlan
(
programId
,
nextDay
);
saveSrvPlan
(
programId
,
dateStr
);
}
}
}
}
...
...
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