Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
f1ba3b61
提交
f1ba3b61
authored
9月 20, 2023
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(自查模块): 自查完成终止系统发起的自查
自查完成终止系统发起的自查
上级
fca1c484
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
308 行增加
和
183 行删除
+308
-183
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+12
-1
StatusEnum.java
...misc/src/main/java/com/tykj/dev/misc/base/StatusEnum.java
+2
-0
SelfCheckSchedulerTask.java
...ykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
+146
-93
SelfCheckController.java
.../dev/device/selfcheck/controller/SelfCheckController.java
+65
-84
SelfCheckBillService.java
...kj/dev/device/selfcheck/service/SelfCheckBillService.java
+12
-0
SelfCheckBillServiceImpl.java
...vice/selfcheck/service/impl/SelfCheckBillServiceImpl.java
+51
-1
SelfCheckBill.java
...ykj/dev/device/selfcheck/subject/domin/SelfCheckBill.java
+1
-1
TaskService.java
...in/java/com/tykj/dev/device/task/service/TaskService.java
+5
-0
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+14
-3
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
f1ba3b61
...
@@ -27,6 +27,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
...
@@ -27,6 +27,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.selfcheck.controller.SelfCheckController
;
import
com.tykj.dev.device.selfcheck.controller.SelfCheckController
;
import
com.tykj.dev.device.selfcheck.service.SelfCheckBillService
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.repository.TaskLogDao
;
import
com.tykj.dev.device.task.repository.TaskLogDao
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskLogService
;
...
@@ -69,6 +70,7 @@ import org.springframework.http.ResponseEntity;
...
@@ -69,6 +70,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StopWatch
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.LocalTime
;
import
java.util.*
;
import
java.util.*
;
...
@@ -158,6 +160,9 @@ public class DeviceCheckController {
...
@@ -158,6 +160,9 @@ public class DeviceCheckController {
@Autowired
@Autowired
private
HistoryCheckDeviceService
historyCheckDeviceService
;
private
HistoryCheckDeviceService
historyCheckDeviceService
;
@Resource
private
SelfCheckBillService
selfCheckBillService
;
@GetMapping
(
"/escow/taskLog"
)
@GetMapping
(
"/escow/taskLog"
)
@ApiOperation
(
value
=
"添加阅知信息:终止检查/核查任务"
)
@ApiOperation
(
value
=
"添加阅知信息:终止检查/核查任务"
)
public
ResponseEntity
fixEscowTaskLog
(
@RequestParam
Integer
detailId
)
{
public
ResponseEntity
fixEscowTaskLog
(
@RequestParam
Integer
detailId
)
{
...
@@ -1084,6 +1089,8 @@ public class DeviceCheckController {
...
@@ -1084,6 +1089,8 @@ public class DeviceCheckController {
// todo
// todo
// statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId());
// statConfirm(taskRepo.findById(taskRepo.findByBillIdAndBusinessType(id, 8).get().getParentTaskId()).get().getBillId());
checkFixUntil
.
finishMinStatByChild
(
id
);
checkFixUntil
.
finishMinStatByChild
(
id
);
//终止系统发起的自查
findBySystemStop
();
}
else
{
}
else
{
//不通过则回到第一阶段
//不通过则回到第一阶段
...
@@ -1096,7 +1103,7 @@ public class DeviceCheckController {
...
@@ -1096,7 +1103,7 @@ public class DeviceCheckController {
}
}
log
.
info
(
"[核查模块] 专管员B操作成功"
);
log
.
info
(
"[核查模块] 专管员B操作成功"
);
//完结系统自查业务
//完结系统自查业务
findBySystem
();
//
findBySystem();
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"专管B操作成功"
));
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"专管B操作成功"
));
}
}
...
@@ -2436,6 +2443,10 @@ public class DeviceCheckController {
...
@@ -2436,6 +2443,10 @@ public class DeviceCheckController {
selfCheckController
.
findBySystem1
();
selfCheckController
.
findBySystem1
();
}
}
private
void
findBySystemStop
()
{
selfCheckBillService
.
findBySystemStop
();
}
/**
/**
* find unit's name by detail's unitId
* find unit's name by detail's unitId
*
*
...
...
dev-misc/src/main/java/com/tykj/dev/misc/base/StatusEnum.java
浏览文件 @
f1ba3b61
...
@@ -262,6 +262,8 @@ public enum StatusEnum {
...
@@ -262,6 +262,8 @@ public enum StatusEnum {
WAITAPPLYTASKTOEND
(
512
,
"申请任务待办结"
),
WAITAPPLYTASKTOEND
(
512
,
"申请任务待办结"
),
SELF_CHECK_STOP
(
513
,
"自查终止"
),
// /**
// /**
// * 等待上传申请回执单
// * 等待上传申请回执单
// */
// */
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
浏览文件 @
f1ba3b61
...
@@ -13,6 +13,7 @@ import com.tykj.dev.misc.base.StatusEnum;
...
@@ -13,6 +13,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.support.CronTrigger
;
import
org.springframework.scheduling.support.CronTrigger
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -29,23 +30,23 @@ import java.util.concurrent.ScheduledFuture;
...
@@ -29,23 +30,23 @@ import java.util.concurrent.ScheduledFuture;
@Data
@Data
public
class
SelfCheckSchedulerTask
{
public
class
SelfCheckSchedulerTask
{
private
String
cron
=
"0 0 0 1 1/3 ? "
;
//
private String cron = "0 0 0 1 1/3 ? ";
//
/**
//
/**
* 月度
//
* 月度
*/
//
*/
private
String
cron1
=
"0 0 0 1 1/1 ? "
;
//
private String cron1 = "0 0 0 1 1/1 ? ";
/**
//
/**
* 季度
//
* 季度
*/
//
*/
private
String
cron2
=
"0 0 0 1 1,4,7,10 ? "
;
//
private String cron2 = "0 0 0 1 1,4,7,10 ? ";
/**
//
/**
* 年度
//
* 年度
*/
//
*/
private
String
cron3
=
"0 0 0 1 1 ? "
;
//
private String cron3 = "0 0 0 1 1 ? ";
//
private
String
cron4
=
"0 0/1 * * * ? "
;
//
private String cron4 = "0 0/1 * * * ? ";
//
final
UnitsDao
unitsDao
;
final
UnitsDao
unitsDao
;
final
TaskService
taskService
;
final
TaskService
taskService
;
...
@@ -57,44 +58,126 @@ public class SelfCheckSchedulerTask {
...
@@ -57,44 +58,126 @@ public class SelfCheckSchedulerTask {
final
SelfCheckBillService
selfCheckBillService
;
final
SelfCheckBillService
selfCheckBillService
;
private
ScheduledFuture
scheduledFuture
;
private
ScheduledFuture
scheduledFuture
;
//
public
SelfCheckSchedulerTask
(
UnitsDao
unitsDao
,
TaskService
taskService
,
SystemVariableService
systemVariableService
,
SystemVariableDao
systemVariableDao
,
SelfCheckBillService
selfCheckBillService
)
{
// //最终需求是改成每个季度的最后一个月的第一天开始执行
this
.
unitsDao
=
unitsDao
;
// private String corner = "0 0 0 1 3,9 ? *";
this
.
taskService
=
taskService
;
//
this
.
systemVariableService
=
systemVariableService
;
// public SelfCheckSchedulerTask(UnitsDao unitsDao,TaskService taskService,SystemVariableService systemVariableService,SystemVariableDao systemVariableDao,SelfCheckBillService selfCheckBillService) {
this
.
systemVariableDao
=
systemVariableDao
;
// this.unitsDao = unitsDao;
this
.
selfCheckBillService
=
selfCheckBillService
;
// this.taskService = taskService;
String
value
;
// this.systemVariableService = systemVariableService;
if
(
systemVariableDao
.
findAll
().
size
()==
0
){
// this.systemVariableDao = systemVariableDao;
value
=
this
.
cron
;
// this.selfCheckBillService = selfCheckBillService;
}
//// String value;
else
{
//// if (systemVariableDao.findAll().size()==0){
value
=
Objects
.
requireNonNull
(
systemVariableService
).
getVaule
(
"selfCheckCycle"
);
//// value = this.cron;
if
(
value
.
length
()!=
14
){
//// }
value
=
cron
;
//// else {
}
//// value = Objects.requireNonNull(systemVariableService).getVaule("selfCheckCycle");
}
//// if (value.length()!=14){
// if ("month".equals(value)){
//// value = cron;
// setCron(cron1);
//// }
//// }
//
//
//// if ("month".equals(value)){
//// setCron(cron1);
//// }
//// if ("quarter".equals(value)){
//// setCron(cron2);
//// }
//// if ("year".equals(value)){
//// setCron(cron3);
//// }
//// if ("minute".equals(value)){
//// setCron(cron4);
//// }
//// setCron(value);
// setCron(corner);
//// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(corner).nextExecutionTime(triggerContext));
// }
//
// public class SelfCheckTask implements Runnable{
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void run() {
// 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);
// StringBuffer title = new StringBuffer();
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(new Date());
// int year = calendar.get(Calendar.YEAR);
// int month = calendar.get(Calendar.MONTH)+1;
// title.append("系统发起定时"+units.getName());
// title.append(year).append("年");
// title.append(month).append("月自查任务");
// //修改为永远是季度发起
// selfCheckBill.setCycle(2);
//// int type;
//// if (' '==cron.charAt(11)) {
//// type = Integer.parseInt(cron.substring(10,11));
//// }
//// else {
//// type = Integer.parseInt(cron.substring(10,12));
//// }
//// if (type==1) {
//// selfCheckBill.setCycle(1);
//// }
//// else if (type==3){
//// selfCheckBill.setCycle(2);
//// }
//// else if (type==12){
//// selfCheckBill.setCycle(3);
//// }
//// else {
//// selfCheckBill.setCycle(type+2);
//// }
//// if (cron.equals(cron1)){
//// title.append(month).append("月自查任务");
//// selfCheckBill.setCycle(1);
//// }
//// else if (cron.equals(cron2)){
//// title.append(getQuarter(month)).append("自查任务");
//// selfCheckBill.setCycle(2);
//// }
//// else if (cron.equals(cron3)){
//// title.append("自查任务");
//// selfCheckBill.setCycle(3);
//// }
//// else {
//// title.append("自查任务");
//// selfCheckBill.setCycle(0);
//// }
// 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);
// });
// }
// }
// if ("quarter".equals(value)){
// log.info("[自查模块]:自查定时任务执行了");
// setCron(cron2);
// }
// }
// if ("year".equals(value)){
// setCron(cron3);
// }
// }
// if ("minute".equals(value)){
//
// setCron(cron4);
// public void startTask(){
//// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(cron).nextExecutionTime(triggerContext));
// scheduledFuture = TaskBeanConfig.getThreadPoolTaskScheduler().schedule(new SelfCheckTask(), triggerContext -> new CronTrigger(corner).nextExecutionTime(triggerContext));
// }
// }
setCron
(
value
);
scheduledFuture
=
TaskBeanConfig
.
getThreadPoolTaskScheduler
().
schedule
(
new
SelfCheckTask
(),
triggerContext
->
new
CronTrigger
(
cron
).
nextExecutionTime
(
triggerContext
));
}
public
class
SelfCheckTask
implements
Runnable
{
@Scheduled
(
cron
=
"0 0 0 1 3,9 ?"
)
@Override
public
void
selfCheckStart
()
{
@Transactional
(
rollbackFor
=
Exception
.
class
)
if
(
unitsDao
!=
null
&&
taskService
!=
null
&&
selfCheckBillService
!=
null
)
{
public
void
run
()
{
if
(
unitsDao
!=
null
&&
taskService
!=
null
&&
selfCheckBillService
!=
null
)
{
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
unitsList
.
forEach
(
units
->
{
unitsList
.
forEach
(
units
->
{
//添加账单
//添加账单
...
@@ -104,64 +187,34 @@ public class SelfCheckSchedulerTask {
...
@@ -104,64 +187,34 @@ public class SelfCheckSchedulerTask {
selfCheckBill
.
setCheckUnitId
(
units
.
getUnitId
());
selfCheckBill
.
setCheckUnitId
(
units
.
getUnitId
());
//add zsp
//add zsp
selfCheckBill
.
setStorageLocationId
(
0
);
selfCheckBill
.
setStorageLocationId
(
0
);
StringBuffer
title
=
new
StringBuff
er
();
StringBuilder
title
=
new
StringBuild
er
();
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)+
1
;
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
title
.
append
(
"系统发起定时"
+
units
.
getName
());
title
.
append
(
"系统发起定时"
)
title
.
append
(
year
).
append
(
"年"
);
.
append
(
units
.
getName
())
title
.
append
(
month
).
append
(
"月自查任务"
);
.
append
(
units
.
getName
())
int
type
;
.
append
(
year
).
append
(
"年"
)
if
(
' '
==
cron
.
charAt
(
11
))
{
.
append
(
month
).
append
(
"月自查任务"
);
type
=
Integer
.
parseInt
(
cron
.
substring
(
10
,
11
));
//修改为永远是季度发起
}
else
{
type
=
Integer
.
parseInt
(
cron
.
substring
(
10
,
12
));
}
if
(
type
==
1
)
{
selfCheckBill
.
setCycle
(
1
);
}
else
if
(
type
==
3
){
selfCheckBill
.
setCycle
(
2
);
selfCheckBill
.
setCycle
(
2
);
}
else
if
(
type
==
12
){
selfCheckBill
.
setCycle
(
3
);
}
else
{
selfCheckBill
.
setCycle
(
type
+
2
);
}
// if (cron.equals(cron1)){
// title.append(month).append("月自查任务");
// selfCheckBill.setCycle(1);
// }
// else if (cron.equals(cron2)){
// title.append(getQuarter(month)).append("自查任务");
// selfCheckBill.setCycle(2);
// }
// else if (cron.equals(cron3)){
// title.append("自查任务");
// selfCheckBill.setCycle(3);
// }
// else {
// title.append("自查任务");
// selfCheckBill.setCycle(0);
// }
selfCheckBill
.
setTitle
(
title
.
toString
());
selfCheckBill
.
setTitle
(
title
.
toString
());
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
//发起待自查任务
//发起待自查任务
List
<
Integer
>
userIds
=
new
ArrayList
<>();
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
0
);
userIds
.
add
(
0
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_SELF_CHECK
.
id
,
title
.
toString
(),
null
,
"."
,
selfCheckBill1
.
getId
(),
4
,
units
.
getUnitId
(),
0
,
null
,
userIds
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_SELF_CHECK
.
id
,
title
.
toString
(),
null
,
"."
,
selfCheckBill1
.
getId
(),
4
,
units
.
getUnitId
(),
0
,
null
,
userIds
);
taskService
.
start
(
taskBto
);
taskService
.
start
(
taskBto
);
});
});
}
log
.
info
(
"[自查模块]:自查定时任务执行了"
);
log
.
info
(
"[自查模块]:自查定时任务执行了"
);
}
}
}
}
public
void
startTask
(){
@Scheduled
(
cron
=
"0 0 0 1 4,10 ?"
)
scheduledFuture
=
TaskBeanConfig
.
getThreadPoolTaskScheduler
().
schedule
(
new
SelfCheckTask
(),
triggerContext
->
new
CronTrigger
(
cron
).
nextExecutionTime
(
triggerContext
));
public
void
selfCheckEnd
()
{
log
.
info
(
"[自查模块]:自动完结自查定时任务准备执行"
);
selfCheckBillService
.
getNoFinShBySystem
();
}
}
/**
/**
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/controller/SelfCheckController.java
浏览文件 @
f1ba3b61
...
@@ -163,60 +163,60 @@ public class SelfCheckController {
...
@@ -163,60 +163,60 @@ public class SelfCheckController {
return
ResponseEntity
.
ok
(
type
);
return
ResponseEntity
.
ok
(
type
);
}
}
@ApiOperation
(
value
=
"设置自查周期"
,
notes
=
"可以通过这个接口设置自查周期"
)
// @ApiOperation(value = "设置自查周期", notes = "可以通过这个接口设置自查周期")
@PostMapping
(
value
=
"/set/cycle/{type}"
)
// @PostMapping(value = "/set/cycle/{type}")
@Transactional
(
rollbackFor
=
Exception
.
class
)
// @Transactional(rollbackFor = Exception.class)
public
ResponseEntity
setCycle
(
@PathVariable
(
"type"
)
int
type
){
// public ResponseEntity setCycle(@PathVariable("type") int type){
if
(
selfCheckSchedulerTask
!=
null
)
{
// if (selfCheckSchedulerTask!=null) {
String
corn
=
"0 0 0 1 1/"
+
type
+
" ? "
;
// String corn = "0 0 0 1 1/"+type+" ? ";
ScheduledFuture
scheduledFuture
=
selfCheckSchedulerTask
.
getScheduledFuture
();
scheduledFuture
.
cancel
(
true
);
selfCheckSchedulerTask
.
setCron
(
corn
);
selfCheckSchedulerTask
.
startTask
();
systemVariableService
.
setVaule
(
"selfCheckCycle"
,
corn
);
log
.
info
(
"[自查模块]:自查周期更改为"
+
type
+
"个月"
);
return
ResponseEntity
.
ok
(
"自查周期更改为"
+
type
+
"个月"
);
// switch (type) {
// case 1:
// selfCheckSchedulerTask.setCron(cron1);
// ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
// ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
// scheduledFuture.cancel(true);
// scheduledFuture.cancel(true);
// selfCheckSchedulerTask.setCron(corn);
// selfCheckSchedulerTask.startTask();
// selfCheckSchedulerTask.startTask();
// systemVariableService.setVaule("selfCheckCycle","month");
// systemVariableService.setVaule("selfCheckCycle",corn);
// log.info("[自查模块]:自查周期更改为月度");
// log.info("[自查模块]:自查周期更改为"+type+"个月");
// return ResponseEntity.ok("自查周期更改为月度");
// return ResponseEntity.ok("自查周期更改为"+type+"个月");
// case 2:
//// switch (type) {
// selfCheckSchedulerTask.setCron(cron2);
//// case 1:
// ScheduledFuture scheduledFuture2 = selfCheckSchedulerTask.getScheduledFuture();
//// selfCheckSchedulerTask.setCron(cron1);
// scheduledFuture2.cancel(true);
//// ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
// selfCheckSchedulerTask.startTask();
//// scheduledFuture.cancel(true);
// systemVariableService.setVaule("selfCheckCycle","quarter");
//// selfCheckSchedulerTask.startTask();
// log.info("[自查模块]:自查周期更改为季度");
//// systemVariableService.setVaule("selfCheckCycle","month");
// return ResponseEntity.ok("自查周期更改为季度");
//// log.info("[自查模块]:自查周期更改为月度");
// case 3:
//// return ResponseEntity.ok("自查周期更改为月度");
// selfCheckSchedulerTask.setCron(cron3);
//// case 2:
// ScheduledFuture scheduledFuture3 = selfCheckSchedulerTask.getScheduledFuture();
//// selfCheckSchedulerTask.setCron(cron2);
// scheduledFuture3.cancel(true);
//// ScheduledFuture scheduledFuture2 = selfCheckSchedulerTask.getScheduledFuture();
// selfCheckSchedulerTask.startTask();
//// scheduledFuture2.cancel(true);
// systemVariableService.setVaule("selfCheckCycle","year");
//// selfCheckSchedulerTask.startTask();
// log.info("[自查模块]:自查周期更改为年度");
//// systemVariableService.setVaule("selfCheckCycle","quarter");
// return ResponseEntity.ok("自查周期更改为年度");
//// log.info("[自查模块]:自查周期更改为季度");
// case 4:
//// return ResponseEntity.ok("自查周期更改为季度");
// selfCheckSchedulerTask.setCron(cron4);
//// case 3:
// ScheduledFuture scheduledFuture4 = selfCheckSchedulerTask.getScheduledFuture();
//// selfCheckSchedulerTask.setCron(cron3);
// scheduledFuture4.cancel(true);
//// ScheduledFuture scheduledFuture3 = selfCheckSchedulerTask.getScheduledFuture();
// selfCheckSchedulerTask.startTask();
//// scheduledFuture3.cancel(true);
// systemVariableService.setVaule("selfCheckCycle","minute");
//// selfCheckSchedulerTask.startTask();
// log.info("[自查模块]:自查周期更改为每分钟");
//// systemVariableService.setVaule("selfCheckCycle","year");
// return ResponseEntity.ok("自查周期更改为每分钟");
//// log.info("[自查模块]:自查周期更改为年度");
// default:
//// return ResponseEntity.ok("自查周期更改为年度");
// return ResponseEntity.ok(ResultUtil.failed("设置失败:type只能为1,2,3"));
//// case 4:
//// selfCheckSchedulerTask.setCron(cron4);
//// ScheduledFuture scheduledFuture4 = selfCheckSchedulerTask.getScheduledFuture();
//// scheduledFuture4.cancel(true);
//// selfCheckSchedulerTask.startTask();
//// systemVariableService.setVaule("selfCheckCycle","minute");
//// log.info("[自查模块]:自查周期更改为每分钟");
//// return ResponseEntity.ok("自查周期更改为每分钟");
//// default:
//// return ResponseEntity.ok(ResultUtil.failed("设置失败:type只能为1,2,3"));
//// }
// }
// else {
// throw new ApiException(ResultUtil.failed("selfCheckSchedulerTask为null"));
// }
// }
// }
}
else
{
throw
new
ApiException
(
ResultUtil
.
failed
(
"selfCheckSchedulerTask为null"
));
}
}
@ApiOperation
(
value
=
"装备比较"
,
notes
=
"可以通过这个接口发起比较装备"
)
@ApiOperation
(
value
=
"装备比较"
,
notes
=
"可以通过这个接口发起比较装备"
)
@PostMapping
(
value
=
"/compare"
)
@PostMapping
(
value
=
"/compare"
)
...
@@ -683,6 +683,8 @@ public class SelfCheckController {
...
@@ -683,6 +683,8 @@ public class SelfCheckController {
});
});
log
.
info
(
"[自查模块]:审核通过自查完成"
);
log
.
info
(
"[自查模块]:审核通过自查完成"
);
myWebSocket
.
sendMessage1
();
myWebSocket
.
sendMessage1
();
//审核通过 系统发起的自查进行终止
selfCheckBillService
.
findBySystemStop
();
return
ResultUtil
.
success
(
"审核通过自查完成"
);
return
ResultUtil
.
success
(
"审核通过自查完成"
);
}
}
//审核不通过,改变账单和任务状态
//审核不通过,改变账单和任务状态
...
@@ -883,41 +885,7 @@ public class SelfCheckController {
...
@@ -883,41 +885,7 @@ public class SelfCheckController {
title
.
append
(
"系统发起定时"
+
units
.
getName
());
title
.
append
(
"系统发起定时"
+
units
.
getName
());
title
.
append
(
year
).
append
(
"年"
);
title
.
append
(
year
).
append
(
"年"
);
title
.
append
(
month
).
append
(
"月自查任务"
);
title
.
append
(
month
).
append
(
"月自查任务"
);
int
type
=
1
;
// if (' '==cron.charAt(11)) {
// type = Integer.parseInt(cron.substring(10,11));
// }
// else {
// type = Integer.parseInt(cron.substring(10,12));
// }
if
(
type
==
1
)
{
selfCheckBill
.
setCycle
(
1
);
}
else
if
(
type
==
3
){
selfCheckBill
.
setCycle
(
2
);
selfCheckBill
.
setCycle
(
2
);
}
else
if
(
type
==
12
){
selfCheckBill
.
setCycle
(
3
);
}
else
{
selfCheckBill
.
setCycle
(
type
+
2
);
}
// if (cron.equals(cron1)){
// title.append(month).append("月自查任务");
// selfCheckBill.setCycle(1);
// }
// else if (cron.equals(cron2)){
// title.append(getQuarter(month)).append("自查任务");
// selfCheckBill.setCycle(2);
// }
// else if (cron.equals(cron3)){
// title.append("自查任务");
// selfCheckBill.setCycle(3);
// }
// else {
// title.append("自查任务");
// selfCheckBill.setCycle(0);
// }
selfCheckBill
.
setTitle
(
title
.
toString
());
selfCheckBill
.
setTitle
(
title
.
toString
());
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
SelfCheckBill
selfCheckBill1
=
selfCheckBillService
.
addEntity
(
selfCheckBill
);
//发起待自查任务
//发起待自查任务
...
@@ -948,6 +916,12 @@ public class SelfCheckController {
...
@@ -948,6 +916,12 @@ public class SelfCheckController {
}
}
}
}
@ApiOperation
(
value
=
"查询时间段系统发其自查任务并进行终止"
,
notes
=
"查询时间段系统发其自查任务并进行终止"
)
@GetMapping
(
value
=
"/findBySystemStop"
)
public
void
findBySystemStop
()
{
selfCheckBillService
.
findBySystemStop
();
}
@ApiOperation
(
value
=
"自查任务撤回"
,
notes
=
"根据任务id撤回自查任务"
)
@ApiOperation
(
value
=
"自查任务撤回"
,
notes
=
"根据任务id撤回自查任务"
)
@GetMapping
(
"/revokeTask/taskId"
)
@GetMapping
(
"/revokeTask/taskId"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -1297,4 +1271,11 @@ public class SelfCheckController {
...
@@ -1297,4 +1271,11 @@ public class SelfCheckController {
return
ResponseEntity
.
ok
(
selfCheckBillService
.
traceabilityParsing
(
billId
));
return
ResponseEntity
.
ok
(
selfCheckBillService
.
traceabilityParsing
(
billId
));
}
}
@GetMapping
(
value
=
"finishTest"
)
@ApiOperation
(
value
=
"测试完结系统发起自查"
,
notes
=
"测试完结系统发起自查"
)
public
ResponseEntity
finishTest
(){
selfCheckBillService
.
getNoFinShBySystem
();
return
ResponseEntity
.
ok
(
"完成"
);
}
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/service/SelfCheckBillService.java
浏览文件 @
f1ba3b61
...
@@ -85,4 +85,16 @@ public interface SelfCheckBillService {
...
@@ -85,4 +85,16 @@ public interface SelfCheckBillService {
void
historyUpperChain
();
void
historyUpperChain
();
boolean
checkTrueData
(
Integer
billId
);
boolean
checkTrueData
(
Integer
billId
);
/**
* 查询未完成的系统发起自查任务 并进行自动完结
* @return
*/
void
getNoFinShBySystem
();
/**
* 查询未完成的系统发起自查任务 并进行终止
*/
void
findBySystemStop
();
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/service/impl/SelfCheckBillServiceImpl.java
浏览文件 @
f1ba3b61
...
@@ -32,6 +32,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
...
@@ -32,6 +32,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.task.subject.vo.TaskLogUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskLogUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.user.cache.UserCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
...
@@ -57,6 +58,7 @@ import org.springframework.data.jpa.domain.Specification;
...
@@ -57,6 +58,7 @@ import org.springframework.data.jpa.domain.Specification;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.Transient
;
import
javax.persistence.Transient
;
...
@@ -116,7 +118,7 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
...
@@ -116,7 +118,7 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Override
@Override
public
SelfCheckBill
addEntity
(
SelfCheckBill
selfExaminationBillEntity
)
{
public
SelfCheckBill
addEntity
(
SelfCheckBill
selfExaminationBillEntity
)
{
SelfCheckBill
selfCheckBill
=
selfExaminationBillDao
.
save
(
selfExaminationBillEntity
);
SelfCheckBill
selfCheckBill
=
selfExaminationBillDao
.
save
(
selfExaminationBillEntity
);
sendText
(
selfCheckBill
.
getId
());
//
sendText(selfCheckBill.getId());
return
selfCheckBill
;
return
selfCheckBill
;
}
}
...
@@ -416,6 +418,54 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
...
@@ -416,6 +418,54 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
return
blockDataService
.
contrast
(
blockTraceabilityParsing
);
return
blockDataService
.
contrast
(
blockTraceabilityParsing
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
getNoFinShBySystem
()
{
// LocalDate now = LocalDate.now();
LocalDate
now
=
LocalDate
.
parse
(
"2023-10-07"
);
List
<
SelfCheckBill
>
billList
=
selfExaminationBillDao
.
findAll
()
.
stream
()
.
filter
(
selfCheckBill
->
selfCheckBill
.
getCycle
()
==
2
&&
selfCheckBill
.
getCheckStatus
()
==
3
&&
selfCheckBill
.
getTitle
().
contains
(
"系统发起"
)
&&
DateUtil
.
getLocalDate
(
selfCheckBill
.
getCreateTime
()).
plusMonths
(
1
).
equals
(
now
))
.
collect
(
Collectors
.
toList
());
if
(
billList
.
size
()
>
0
)
{
log
.
info
(
"[自查模块]:自动完结自查定时任务开始执行"
);
billList
.
forEach
(
selfCheckBill
->
selfCheckBill
.
setCheckStatus
(
4
));
List
<
Integer
>
billIdList
=
billList
.
stream
()
.
map
(
SelfCheckBill:
:
getId
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
List
<
TaskBto
>
taskBtoList
=
taskService
.
findBillIdAndBillType
(
billIdList
,
4
);
taskBtoList
.
forEach
(
taskBto
->
{
taskService
.
moveToStop
(
taskBto
);
});
selfExaminationBillDao
.
saveAll
(
billList
);
log
.
info
(
"[自查模块]:自动完结自查定时任务执行完成"
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
findBySystemStop
()
{
//通过billId和businessType 和 ownUnit
List
<
Task
>
allByBillAndBusinessTypeAndOwnUnit
=
taskService
.
findAllByBillAndBusinessTypeAndOwnUnit
(
4
,
userUtils
.
getCurrentUnitId
());
if
(
allByBillAndBusinessTypeAndOwnUnit
.
size
()>
0
){
for
(
Task
task
:
allByBillAndBusinessTypeAndOwnUnit
)
{
taskService
.
moveToArchive
(
task
.
parse2Bto
());
SelfCheckBill
selfCheckBill
=
getOne
(
task
.
getBillId
());
if
(
selfCheckBill
!=
null
){
//业务设置为终止
selfCheckBill
.
setCheckStatus
(
4
);
selfExaminationBillDao
.
save
(
selfCheckBill
);
}
}
}
}
@Override
@Override
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
SELF_CHECK
.
id
,
billId
);
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
SELF_CHECK
.
id
,
billId
);
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/subject/domin/SelfCheckBill.java
浏览文件 @
f1ba3b61
...
@@ -97,7 +97,7 @@ public class SelfCheckBill {
...
@@ -97,7 +97,7 @@ public class SelfCheckBill {
@ApiModelProperty
(
value
=
"非在库装备转JSon"
)
@ApiModelProperty
(
value
=
"非在库装备转JSon"
)
private
String
unStockDetail
;
private
String
unStockDetail
;
/**
/**
* 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)
* 自查状态(0:待审核,1:审核失败,2:自查完成,3:未检
4:终止
)
*/
*/
@ApiModelProperty
(
value
=
"自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)"
)
@ApiModelProperty
(
value
=
"自查状态(0:待审核,1:审核失败,2:自查完成,3:未检)"
)
private
Integer
checkStatus
;
private
Integer
checkStatus
;
...
...
dev-task/src/main/java/com/tykj/dev/device/task/service/TaskService.java
浏览文件 @
f1ba3b61
...
@@ -276,4 +276,9 @@ public interface TaskService {
...
@@ -276,4 +276,9 @@ public interface TaskService {
*/
*/
Task
findByParentId
(
Integer
parentTaskId
);
Task
findByParentId
(
Integer
parentTaskId
);
/**
* 业务终止封存
*/
void
moveToStop
(
TaskBto
taskBto
);
}
}
dev-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
f1ba3b61
...
@@ -42,6 +42,7 @@ import org.springframework.data.jpa.domain.Specification;
...
@@ -42,6 +42,7 @@ import org.springframework.data.jpa.domain.Specification;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
@@ -654,11 +655,13 @@ public class TaskServiceImpl implements TaskService {
...
@@ -654,11 +655,13 @@ public class TaskServiceImpl implements TaskService {
if
(
taskSelectVo
.
getAreaId
()!=
null
){
if
(
taskSelectVo
.
getAreaId
()!=
null
){
List
<
Integer
>
unitIds
=
userPublicService
.
findByAreaExhibitionIdSubordinateAll
(
taskSelectVo
.
getAreaId
()).
stream
().
map
(
Units:
:
getUnitId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
unitIds
=
userPublicService
.
findByAreaExhibitionIdSubordinateAll
(
taskSelectVo
.
getAreaId
()).
stream
().
map
(
Units:
:
getUnitId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
userIDs
=
userCache
.
findAllByUnitsIdIn
(
unitIds
).
stream
().
map
(
User:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
userIDs
=
userCache
.
findAllByUnitsIdIn
(
unitIds
).
stream
().
map
(
User:
:
getUserId
).
collect
(
Collectors
.
toList
());
taskUserVos
=
taskUserVos
.
stream
().
filter
(
taskUserVo
->
userIDs
.
contains
(
taskUserVo
.
getCreateUserId
())).
collect
(
Collectors
.
toList
());
// taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList());
taskUserVos
=
taskUserVos
.
stream
().
filter
(
taskUserVo
->
userIDs
.
contains
(
taskUserVo
.
getCreateUserId
())
||
taskUserVo
.
getCreateUserId
()
==
null
).
collect
(
Collectors
.
toList
());
}
}
if
(
taskSelectVo
.
getUnitId
()!=
null
){
if
(
taskSelectVo
.
getUnitId
()!=
null
){
List
<
Integer
>
userIDs
=
userService
.
findAllByUnitId
(
taskSelectVo
.
getUnitId
()).
stream
().
map
(
User:
:
getUserId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
userIDs
=
userService
.
findAllByUnitId
(
taskSelectVo
.
getUnitId
()).
stream
().
map
(
User:
:
getUserId
).
collect
(
Collectors
.
toList
());
taskUserVos
=
taskUserVos
.
stream
().
filter
(
taskUserVo
->
userIDs
.
contains
(
taskUserVo
.
getCreateUserId
())).
collect
(
Collectors
.
toList
());
// taskUserVos=taskUserVos.stream().filter(taskUserVo -> userIDs.contains(taskUserVo.getCreateUserId())).collect(Collectors.toList());
taskUserVos
=
taskUserVos
.
stream
().
filter
(
taskUserVo
->
userIDs
.
contains
(
taskUserVo
.
getCreateUserId
())
||
taskUserVo
.
getCreateUserId
()
==
null
).
collect
(
Collectors
.
toList
());
}
}
taskUserVos
=
taskUserVos
.
stream
()
taskUserVos
=
taskUserVos
.
stream
()
...
@@ -1244,6 +1247,13 @@ public class TaskServiceImpl implements TaskService {
...
@@ -1244,6 +1247,13 @@ public class TaskServiceImpl implements TaskService {
return
taskDao
.
findByParentTaskId
(
parentTaskId
);
return
taskDao
.
findByParentTaskId
(
parentTaskId
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
moveToStop
(
TaskBto
taskBto
)
{
taskBto
.
setBillStatus
(
StatusEnum
.
SELF_CHECK_STOP
.
id
);
update
(
taskBto
);
}
@Override
@Override
public
void
moveAllSonNodeToEnd
(
Integer
taskId
)
{
public
void
moveAllSonNodeToEnd
(
Integer
taskId
)
{
List
<
Task
>
tasks
=
taskDao
.
findAllByParentTaskId
(
taskId
);
List
<
Task
>
tasks
=
taskDao
.
findAllByParentTaskId
(
taskId
);
...
@@ -1273,7 +1283,8 @@ public class TaskServiceImpl implements TaskService {
...
@@ -1273,7 +1283,8 @@ public class TaskServiceImpl implements TaskService {
.
filter
(
task
->
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
END
.
id
))
.
filter
(
task
->
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
END
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
ARCHIVE
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
ARCHIVE
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
REVOKEALLOTTASK
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
REVOKEALLOTTASK
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
CHECK_SHUT_DOWN
.
id
)))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
CHECK_SHUT_DOWN
.
id
))
&&
(!
task
.
getBillStatus
().
equals
(
StatusEnum
.
SELF_CHECK_STOP
.
id
)))
.
filter
(
o
->
{
.
filter
(
o
->
{
if
(
o
.
getExhibit
()
==
null
)
{
if
(
o
.
getExhibit
()
==
null
)
{
return
true
;
return
true
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论