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
53b3350e
Commit
53b3350e
authored
Feb 27, 2023
by
zhangwanglin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务
parent
c5a7d765
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
10 deletions
+28
-10
DateUtils.java
...n-core/src/main/java/com/hungraim/ltc/util/DateUtils.java
+14
-0
SrvTaskServiceImpl.java
...graim/ltc/governance/service/impl/SrvTaskServiceImpl.java
+6
-6
ChSrvTaskDetailMapper.xml
.../hungraim/ltc/governance/mapper/ChSrvTaskDetailMapper.xml
+3
-1
SrvTaskMapper.xml
...rces/com/hungraim/ltc/governance/mapper/SrvTaskMapper.xml
+4
-2
SrvTaskScheduledController.java
...raim/ltc/system/Scheduled/SrvTaskScheduledController.java
+1
-1
No files found.
common/common-core/src/main/java/com/hungraim/ltc/util/DateUtils.java
View file @
53b3350e
...
@@ -8,6 +8,7 @@ import java.text.ParsePosition;
...
@@ -8,6 +8,7 @@ import java.text.ParsePosition;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.GregorianCalendar
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
public
class
DateUtils
{
public
class
DateUtils
{
...
@@ -916,4 +917,17 @@ public class DateUtils {
...
@@ -916,4 +917,17 @@ public class DateUtils {
return
false
;
return
false
;
}
}
public
static
String
getNextDay
(){
Date
date
=
new
Date
();
//取时间
Calendar
calendar
=
new
GregorianCalendar
();
calendar
.
setTime
(
date
);
// 1表示明天,-1表示昨天
calendar
.
add
(
Calendar
.
DATE
,
1
);
date
=
calendar
.
getTime
();
// 这个时间就是明天
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
dateString
=
formatter
.
format
(
date
);
return
dateString
;
}
}
}
governance/src/main/java/com/hungraim/ltc/governance/service/impl/SrvTaskServiceImpl.java
View file @
53b3350e
package
com
.
hungraim
.
ltc
.
governance
.
service
.
impl
;
package
com
.
hungraim
.
ltc
.
governance
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
@@ -17,7 +15,6 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
...
@@ -17,7 +15,6 @@ import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import
com.hungraim.ltc.pojo.entity.governance.ChSrvPlan
;
import
com.hungraim.ltc.pojo.entity.governance.ChSrvPlan
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail
;
import
com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskFinishItem
;
import
com.hungraim.ltc.pojo.vo.governance.*
;
import
com.hungraim.ltc.pojo.vo.governance.*
;
import
com.hungraim.ltc.pojo.vo.system.AttachUpdateVo
;
import
com.hungraim.ltc.pojo.vo.system.AttachUpdateVo
;
import
com.hungraim.ltc.util.AttachType
;
import
com.hungraim.ltc.util.AttachType
;
...
@@ -144,6 +141,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
...
@@ -144,6 +141,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTask
.
setDisabInfoId
(
Long
.
parseLong
(
disabInfoId
));
// 失能人员id
chSrvTask
.
setDisabInfoId
(
Long
.
parseLong
(
disabInfoId
));
// 失能人员id
chSrvTask
.
setSrvEmpId
(
Long
.
parseLong
(
srvTaskInfoVO
.
getSrvEmpId
()));
//服务人员id
chSrvTask
.
setSrvEmpId
(
Long
.
parseLong
(
srvTaskInfoVO
.
getSrvEmpId
()));
//服务人员id
chSrvTask
.
setStatus
((
short
)
1
);
//状态 未分配:0;已分配:1;已终止2
chSrvTask
.
setStatus
((
short
)
1
);
//状态 未分配:0;已分配:1;已终止2
chSrvTask
.
setSrvDate
(
DateUtils
.
strToDate
(
taskDetails
.
get
(
0
)));
srvTaskMapper
.
insert
(
chSrvTask
);
srvTaskMapper
.
insert
(
chSrvTask
);
//添加服务计划详情
//添加服务计划详情
Long
newSrvTaskId
=
chSrvTask
.
getSrvTaskId
();
Long
newSrvTaskId
=
chSrvTask
.
getSrvTaskId
();
...
@@ -212,10 +210,12 @@ public class SrvTaskServiceImpl implements SrvTaskService {
...
@@ -212,10 +210,12 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// 生成计划任务 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和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
List
<
ChSrvTaskDetail
>
chSrvTaskDetailList
=
chSrvTaskDetailMapper
.
selectList
(
new
QueryWrapper
<
ChSrvTaskDetail
>().
eq
(
"srv_task_id"
,
srvTaskId
));
int
chSrvTaskDetailCount
=
chSrvTaskDetailMapper
if
(
CollectionUtil
.
isNotEmpty
(
chSrvTaskDetailList
)){
.
getSrvTaskDetail
(
String
.
valueOf
(
srvTaskId
),
nextDay
);
if
(
chSrvTaskDetailCount
>
0
)
{
return
;
}
}
ChSrvTaskDetail
chSrvTaskDetail
=
new
ChSrvTaskDetail
();
ChSrvTaskDetail
chSrvTaskDetail
=
new
ChSrvTaskDetail
();
chSrvTaskDetail
.
setSrvTaskId
(
srvTaskId
);
//taskId
chSrvTaskDetail
.
setSrvTaskId
(
srvTaskId
);
//taskId
...
...
governance/src/main/resources/com/hungraim/ltc/governance/mapper/ChSrvTaskDetailMapper.xml
View file @
53b3350e
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
</sql>
</sql>
<select
id=
"getSrvTaskDetail"
>
<select
id=
"getSrvTaskDetail"
>
select count(*) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId} and to_char(t.SRV_DATE) = #{srvDate}
select count(*) from CH_SRV_TASK_DETAIL t where t.SRV_TASK_ID = #{srvTaskId}
and to_char(t.SRV_DATE,'yyyy-MM-dd') = #{srvDate}
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
governance/src/main/resources/com/hungraim/ltc/governance/mapper/SrvTaskMapper.xml
View file @
53b3350e
...
@@ -214,9 +214,10 @@
...
@@ -214,9 +214,10 @@
</where>
</where>
</select>
</select>
<select
id=
"getAllocationSrvTask"
resultType=
"com.hungraim.ltc.pojo.vo.governance.AllocationSrvTaskVO"
>
<select
id=
"getAllocationSrvTask"
resultType=
"com.hungraim.ltc.pojo.vo.governance.AllocationSrvTaskVO"
>
select t.SRV_TASK_ID,t.SRV_DATE,
sysdate,
info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID from CH_SRV_TASK t
select t.SRV_TASK_ID,t.SRV_DATE,info.EXIT_TIME,info.EXIT_FLAG,info.EXIT_REASON_ID from CH_SRV_TASK t
left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID
left join CH_DISABLE_INFO info on t.DISAB_INFO_ID = info.DISAB_INFO_ID
where t.STATUS =1 and info.DISAB_INFO_ID = '327' and sysdate > t.SRV_DATE
where t.SRV_DATE
<![CDATA[ < ]]>
sysdate and
(info.EXIT_TIME
<![CDATA[ > ]]>
sysdate or info.EXIT_TIME is null)
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
system/system-admin-service/src/main/java/com/hungraim/ltc/system/Scheduled/SrvTaskScheduledController.java
View file @
53b3350e
...
@@ -21,7 +21,7 @@ public class SrvTaskScheduledController {
...
@@ -21,7 +21,7 @@ public class SrvTaskScheduledController {
private
final
SrvTaskFeignService
srvTaskFeignService
;
private
final
SrvTaskFeignService
srvTaskFeignService
;
// 表示每天3点5分执行
// 表示每天3点5分执行
@Scheduled
(
cron
=
"30
50 15
* * ?"
)
@Scheduled
(
cron
=
"30
41 17
* * ?"
)
public
void
timeAllocationSrvTask
()
{
public
void
timeAllocationSrvTask
()
{
Result
result
=
srvTaskFeignService
.
timeAllocationSrvTask
();
Result
result
=
srvTaskFeignService
.
timeAllocationSrvTask
();
System
.
out
.
println
();
System
.
out
.
println
();
...
...
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