Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
cea5e8d8
提交
cea5e8d8
authored
9月 22, 2023
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(自查模块): 自查完成终止系统发起的自查
自查完成终止系统发起的自查
上级
f1ba3b61
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
147 行增加
和
55 行删除
+147
-55
SelfCheckSchedulerTask.java
...ykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
+56
-52
SelfCheckTask.java
...a/com/tykj/dev/device/selfcheck/config/SelfCheckTask.java
+88
-0
SelfCheckController.java
.../dev/device/selfcheck/controller/SelfCheckController.java
+3
-3
没有找到文件。
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
浏览文件 @
cea5e8d8
...
...
@@ -13,6 +13,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.support.CronTrigger
;
import
org.springframework.stereotype.Component
;
...
...
@@ -28,6 +29,7 @@ import java.util.concurrent.ScheduledFuture;
@Component
@EnableAsync
@Data
@EnableScheduling
public
class
SelfCheckSchedulerTask
{
// private String cron = "0 0 0 1 1/3 ? ";
...
...
@@ -47,17 +49,17 @@ public class SelfCheckSchedulerTask {
//
// private String cron4 = "0 0/1 * * * ? ";
//
final
UnitsDao
unitsDao
;
final
TaskService
taskService
;
final
SystemVariableService
systemVariableService
;
final
SystemVariableDao
systemVariableDao
;
final
SelfCheckBillService
selfCheckBillService
;
private
ScheduledFuture
scheduledFuture
;
//
final UnitsDao unitsDao;
//
//
final TaskService taskService;
//
//
final SystemVariableService systemVariableService;
//
//
final SystemVariableDao systemVariableDao;
//
//
final SelfCheckBillService selfCheckBillService;
//
//
private ScheduledFuture scheduledFuture;
//
// //最终需求是改成每个季度的最后一个月的第一天开始执行
// private String corner = "0 0 0 1 3,9 ? *";
...
...
@@ -175,47 +177,49 @@ public class SelfCheckSchedulerTask {
// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(corner).nextExecutionTime(triggerContext));
// }
@Scheduled
(
cron
=
"0 0 0 1 3,9 ?"
)
public
void
selfCheckStart
()
{
if
(
unitsDao
!=
null
&&
taskService
!=
null
&&
selfCheckBillService
!=
null
)
{
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
unitsList
.
forEach
(
units
->
{
//添加账单
SelfCheckBill
selfCheckBill
=
new
SelfCheckBill
();
selfCheckBill
.
setCheckStatus
(
3
);
selfCheckBill
.
setCheckUnit
(
units
.
getName
());
selfCheckBill
.
setCheckUnitId
(
units
.
getUnitId
());
//add zsp
selfCheckBill
.
setStorageLocationId
(
0
);
StringBuilder
title
=
new
StringBuilder
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
title
.
append
(
"系统发起定时"
)
.
append
(
units
.
getName
())
.
append
(
units
.
getName
())
.
append
(
year
).
append
(
"年"
)
.
append
(
month
).
append
(
"月自查任务"
);
//修改为永远是季度发起
selfCheckBill
.
setCycle
(
2
);
selfCheckBill
.
setTitle
(
title
.
toString
());
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
//发起待自查任务
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
0
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_SELF_CHECK
.
id
,
title
.
toString
(),
null
,
"."
,
selfCheckBill1
.
getId
(),
4
,
units
.
getUnitId
(),
0
,
null
,
userIds
);
taskService
.
start
(
taskBto
);
});
log
.
info
(
"[自查模块]:自查定时任务执行了"
);
}
}
@Scheduled
(
cron
=
"0 0 0 1 4,10 ?"
)
public
void
selfCheckEnd
()
{
log
.
info
(
"[自查模块]:自动完结自查定时任务准备执行"
);
selfCheckBillService
.
getNoFinShBySystem
();
}
// @Scheduled(cron = "0 0 0 1 3,9 ?")
// public void selfCheckStart() {
// log.info("[自查模块]:开始自查定时任务执行了");
// if (unitsDao != null && taskService != null && selfCheckBillService != null) {
// List<Units> unitsList = unitsDao.findAll();
// unitsList.forEach(units -> {
// //添加账单
// SelfCheckBill selfCheckBill = new SelfCheckBill();
// selfCheckBill.setCheckStatus(3);
// selfCheckBill.setCheckUnit(units.getName());
// selfCheckBill.setCheckUnitId(units.getUnitId());
// //add zsp
// selfCheckBill.setStorageLocationId(0);
// StringBuilder title = new StringBuilder();
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(new Date());
// int year = calendar.get(Calendar.YEAR);
// int month = calendar.get(Calendar.MONTH) + 1;
// title.append("系统发起定时")
// .append(units.getName())
// .append(units.getName())
// .append(year).append("年")
// .append(month).append("月自查任务");
// //修改为永远是季度发起
// selfCheckBill.setCycle(2);
// selfCheckBill.setTitle(title.toString());
// SelfCheckBill selfCheckBill1 = selfCheckBillService.addEntity(selfCheckBill);
// //发起待自查任务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(0);
// TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id, title.toString(), null, ".", selfCheckBill1.getId(), 4, units.getUnitId(), 0, null, userIds);
// taskService.start(taskBto);
// });
// log.info("[自查模块]:自查定时任务执行了");
// }
// log.info("[自查模块]:自查定时任务执行结束了");
// }
//
// @Scheduled(cron = "0 0 0 1 4,10 ?")
// public void selfCheckEnd() {
// log.info("[自查模块]:自动完结自查定时任务准备执行");
// selfCheckBillService.getNoFinShBySystem();
// }
/**
* 当前月份属于本年第几个季度
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/config/SelfCheckTask.java
0 → 100644
浏览文件 @
cea5e8d8
package
com
.
tykj
.
dev
.
device
.
selfcheck
.
config
;
import
com.tykj.dev.device.selfcheck.service.SelfCheckBillService
;
import
com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
lombok.extern.slf4j.Slf4j
;
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
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author: zsp
* @create: 2023-09-21 13:04
**/
@Component
@Slf4j
@EnableScheduling
@EnableAsync
public
class
SelfCheckTask
{
@Resource
private
SelfCheckBillService
selfCheckBillService
;
@Resource
private
TaskService
taskService
;
@Resource
private
UnitsDao
unitsDao
;
@Scheduled
(
cron
=
"0 0 0 1 3,9 ?"
)
@Async
public
void
selfCheckStart
()
{
log
.
info
(
"[自查模块]:开始自查定时任务执行了"
);
if
(
unitsDao
!=
null
&&
taskService
!=
null
&&
selfCheckBillService
!=
null
)
{
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
unitsList
.
forEach
(
units
->
{
//添加账单
SelfCheckBill
selfCheckBill
=
new
SelfCheckBill
();
selfCheckBill
.
setCheckStatus
(
3
);
selfCheckBill
.
setCheckUnit
(
units
.
getName
());
selfCheckBill
.
setCheckUnitId
(
units
.
getUnitId
());
//add zsp
selfCheckBill
.
setStorageLocationId
(
0
);
StringBuilder
title
=
new
StringBuilder
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
title
.
append
(
"系统发起定时"
)
.
append
(
units
.
getName
())
.
append
(
units
.
getName
())
.
append
(
year
).
append
(
"年"
)
.
append
(
month
).
append
(
"月自查任务"
);
//修改为永远是季度发起
selfCheckBill
.
setCycle
(
2
);
selfCheckBill
.
setTitle
(
title
.
toString
());
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
//发起待自查任务
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
0
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_SELF_CHECK
.
id
,
title
.
toString
(),
null
,
"."
,
selfCheckBill1
.
getId
(),
4
,
units
.
getUnitId
(),
0
,
null
,
userIds
);
taskService
.
start
(
taskBto
);
});
log
.
info
(
"[自查模块]:自查定时任务执行了"
);
}
log
.
info
(
"[自查模块]:自查定时任务执行结束了"
);
}
@Scheduled
(
cron
=
"0 0 0 1 4,10 ?"
)
@Async
public
void
selfCheckEnd
()
{
log
.
info
(
"[自查模块]:自动完结自查定时任务准备执行"
);
selfCheckBillService
.
getNoFinShBySystem
();
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/controller/SelfCheckController.java
浏览文件 @
cea5e8d8
...
...
@@ -1201,10 +1201,10 @@ public class SelfCheckController {
// Map<String, Object> detail = selfCheckBillService.selectDetail(billId);
// return ResultUtil.success(detail);
// }
@ApiOperation
(
value
=
"
test"
,
notes
=
"解析二维码
"
)
@
Pos
tMapping
(
value
=
"/test1"
)
@ApiOperation
(
value
=
"
生成定时任务"
,
notes
=
"生成定时任务
"
)
@
Ge
tMapping
(
value
=
"/test1"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
parseCode
(
@RequestBody
List
<
String
>
strings
)
{
public
ResponseEntity
test1
(
)
{
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
unitsList
.
forEach
(
units
->
{
//添加账单
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论