Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
b87eaef2
提交
b87eaef2
authored
10月 10, 2020
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[自查模块]增加系统变量表存储系统的自查周期
上级
3ced4661
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
204 行增加
和
6 行删除
+204
-6
AllotBackBillController.java
.../dev/device/allot/controller/AllotBackBillController.java
+6
-0
AllotBillController.java
...tykj/dev/device/allot/controller/AllotBillController.java
+9
-1
DeviceApplyController.java
...kj/dev/device/apply/controller/DeviceApplyController.java
+2
-0
SystemVariable.java
...c/main/java/com/tykj/dev/config/domin/SystemVariable.java
+29
-0
SystemVariableDao.java
...ava/com/tykj/dev/config/repository/SystemVariableDao.java
+12
-0
SystemVariableService.java
...va/com/tykj/dev/config/service/SystemVariableService.java
+15
-0
SystemVariableServiceImpl.java
...kj/dev/config/service/impl/SystemVariableServiceImpl.java
+34
-0
SystemVariableRun.java
...main/java/com/tykj/dev/config/task/SystemVariableRun.java
+31
-0
SelfCheckSchedulerTask.java
...ykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
+32
-0
SelfCheckController.java
.../dev/device/selfcheck/controller/SelfCheckController.java
+34
-5
没有找到文件。
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBackBillController.java
浏览文件 @
b87eaef2
...
...
@@ -23,6 +23,7 @@ import com.tykj.dev.misc.utils.StringSplitUtil;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -42,6 +43,7 @@ import java.util.List;
@RequestMapping
(
value
=
"/allot"
)
@AutoDocument
@Api
(
tags
=
"装备配发模块"
,
description
=
"装备配发接口"
)
@Slf4j
public
class
AllotBackBillController
{
@Autowired
...
...
@@ -129,6 +131,7 @@ public class AllotBackBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
log
.
info
(
"[配发模块]:配发退回出库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
taskBto1
,
signId
.
toString
()));
}
...
...
@@ -179,6 +182,7 @@ public class AllotBackBillController {
}
}
}
log
.
info
(
"[配发模块]:配发退回接收入库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发退回接收入库"
);
}
...
...
@@ -214,6 +218,7 @@ public class AllotBackBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
log
.
info
(
"[配发模块]:配发退回审核成功并入库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
signId
.
toString
());
}
...
...
@@ -236,6 +241,7 @@ public class AllotBackBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
log
.
info
(
"[配发模块]:配发退回入库审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发退回接收入库审核失败"
);
}
else
{
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillController.java
浏览文件 @
b87eaef2
...
...
@@ -25,6 +25,7 @@ import com.tykj.dev.misc.utils.TimestampUtil;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -44,6 +45,7 @@ import java.util.List;
@RequestMapping
(
value
=
"/allot"
)
@AutoDocument
@Api
(
tags
=
"装备配发模块"
,
description
=
"装备配发接口"
)
@Slf4j
public
class
AllotBillController
{
@Autowired
...
...
@@ -106,6 +108,7 @@ public class AllotBillController {
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[配发模块]:"
+
allotBillEntity
.
getSendUnit
()+
"对"
+
allotBillEntity
.
getReceiveUnit
()
+
"发起配发"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
new
ResultObj
(
allotBillEntity
,
"发起成功"
));
}
...
...
@@ -144,6 +147,7 @@ public class AllotBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
log
.
info
(
"[配发模块]:配发审核成功并出库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
signId
.
toString
());
}
...
...
@@ -165,6 +169,7 @@ public class AllotBillController {
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[配发模块]:配发出库审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发审核失败"
);
}
else
{
...
...
@@ -218,6 +223,7 @@ public class AllotBillController {
}
}
}
log
.
info
(
"[配发模块]:接收并发起入库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发接收入库"
);
}
...
...
@@ -253,6 +259,7 @@ public class AllotBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
log
.
info
(
"[配发模块]:审核成功并入库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
signId
.
toString
());
}
...
...
@@ -275,12 +282,13 @@ public class AllotBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
myWebSocket
.
sendMessage1
();
//生成配发退回子业务
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userUtils
.
getCurrentUserId
());
TaskBto
taskBto1
=
new
TaskBto
(
StatusEnum
.
WAIT_BACK
.
id
,
"配发退回业务"
,
taskBto
.
getId
(),
taskBto
.
getNodeIdDetail
()
+
taskBto
.
getId
()
+
"."
,
0
,
BusinessEnum
.
ALLOT_BACK
.
id
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
TaskBto
task
=
taskService
.
start
(
taskBto1
);
log
.
info
(
"[配发模块]:配发入库审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
task
);
}
else
{
return
ResponseEntity
.
ok
(
"status只能为0或1"
);
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/controller/DeviceApplyController.java
浏览文件 @
b87eaef2
...
...
@@ -33,6 +33,7 @@ import com.tykj.dev.misc.utils.StringSplitUtil;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -48,6 +49,7 @@ import java.util.stream.Collectors;
@Api
(
tags
=
"装备申请模块"
,
description
=
"申请模块"
)
@AutoDocument
@RequestMapping
(
"/apply"
)
@Slf4j
public
class
DeviceApplyController
{
@Autowired
...
...
dev-config/src/main/java/com/tykj/dev/config/domin/SystemVariable.java
0 → 100644
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
config
.
domin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
/**
* 系统变量实体类
*/
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@ApiModel
(
"系统变量表"
)
public
class
SystemVariable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
name
=
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"变量名"
)
private
String
name
;
@ApiModelProperty
(
value
=
"变量值"
)
private
String
vaule
;
}
dev-config/src/main/java/com/tykj/dev/config/repository/SystemVariableDao.java
0 → 100644
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
config
.
repository
;
import
com.tykj.dev.config.domin.SystemVariable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author dengdiyi
*/
public
interface
SystemVariableDao
extends
JpaRepository
<
SystemVariable
,
Integer
>,
JpaSpecificationExecutor
<
SystemVariable
>
{
SystemVariable
findByName
(
String
name
);
}
dev-config/src/main/java/com/tykj/dev/config/service/SystemVariableService.java
0 → 100644
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
config
.
service
;
import
com.tykj.dev.config.domin.SystemVariable
;
/**
* @author dengdiyi
*/
public
interface
SystemVariableService
{
SystemVariable
add
(
SystemVariable
systemVariable
);
String
getVaule
(
String
name
);
SystemVariable
setVaule
(
String
name
,
String
vaule
);
}
dev-config/src/main/java/com/tykj/dev/config/service/impl/SystemVariableServiceImpl.java
0 → 100644
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
config
.
service
.
impl
;
import
com.tykj.dev.config.domin.SystemVariable
;
import
com.tykj.dev.config.repository.SystemVariableDao
;
import
com.tykj.dev.config.service.SystemVariableService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* @author dengdiyi
*/
@Service
public
class
SystemVariableServiceImpl
implements
SystemVariableService
{
@Autowired
private
SystemVariableDao
systemVariableDao
;
@Override
public
SystemVariable
add
(
SystemVariable
systemVariable
)
{
return
systemVariableDao
.
save
(
systemVariable
);
}
@Override
public
String
getVaule
(
String
name
)
{
return
systemVariableDao
.
findByName
(
name
).
getVaule
();
}
@Override
public
SystemVariable
setVaule
(
String
name
,
String
vaule
)
{
SystemVariable
systemVariable
=
systemVariableDao
.
findByName
(
name
);
systemVariable
.
setVaule
(
vaule
);
return
systemVariableDao
.
save
(
systemVariable
);
}
}
dev-config/src/main/java/com/tykj/dev/config/task/SystemVariableRun.java
0 → 100644
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
config
.
task
;
import
com.tykj.dev.config.domin.SystemVariable
;
import
com.tykj.dev.config.repository.SystemVariableDao
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
sun.tools.jar.CommandLine
;
@Slf4j
@Component
public
class
SystemVariableRun
implements
CommandLineRunner
{
@Autowired
private
SystemVariableDao
systemVariableDao
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
if
(
systemVariableDao
.
findAll
().
size
()==
0
){
SystemVariable
systemVariable
=
new
SystemVariable
();
systemVariable
.
setName
(
"selfCheckCycle"
);
systemVariable
.
setVaule
(
"quarter"
);
systemVariableDao
.
save
(
systemVariable
);
log
.
info
(
"系统变量新建成功"
);
}
else
{
log
.
info
(
"已有系统变量不新建"
);
}
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/base/SelfCheckSchedulerTask.java
浏览文件 @
b87eaef2
...
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.selfcheck.base;
import
com.tykj.dev.config.GlobalMap
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.service.SystemVariableService
;
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
;
...
...
@@ -23,6 +24,7 @@ import java.lang.reflect.InvocationHandler;
import
java.lang.reflect.Proxy
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.ScheduledFuture
;
/**
...
...
@@ -36,13 +38,43 @@ public class SelfCheckSchedulerTask {
private
String
cron
=
"0 0 0 1 3,6,9,12 ? "
;
/**
* 月度
*/
private
String
cron1
=
"0 0 0 1 1/1 ? "
;
/**
* 季度
*/
private
String
cron2
=
"0 0 0 1 3,6,9,12 ? "
;
/**
* 年度
*/
private
String
cron3
=
"0 0 0 1 1 ? "
;
private
String
cron4
=
"0 0/1 * * * ? "
;
private
UnitsDao
unitsDao
=
SpringUtils
.
getBean
(
"unitsDao"
);
private
TaskService
taskService
=
SpringUtils
.
getBean
(
"taskServiceImpl"
);
private
SystemVariableService
systemVariableService
=
SpringUtils
.
getBean
(
"systemVariableServiceImpl"
);
private
ScheduledFuture
scheduledFuture
;
public
SelfCheckSchedulerTask
()
{
String
vaule
=
Objects
.
requireNonNull
(
systemVariableService
).
getVaule
(
"selfCheckCycle"
);
if
(
"month"
.
equals
(
vaule
)){
setCron
(
cron1
);
}
if
(
"quarter"
.
equals
(
vaule
)){
setCron
(
cron2
);
}
if
(
"year"
.
equals
(
vaule
)){
setCron
(
cron3
);
}
if
(
"minute"
.
equals
(
vaule
)){
setCron
(
cron4
);
}
scheduledFuture
=
TaskBeanConfig
.
getThreadPoolTaskScheduler
().
schedule
(
new
SelfCheckTask
(),
triggerContext
->
new
CronTrigger
(
cron
).
nextExecutionTime
(
triggerContext
));
}
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/controller/SelfCheckController.java
浏览文件 @
b87eaef2
package
com
.
tykj
.
dev
.
device
.
selfcheck
.
controller
;
import
com.tykj.dev.config.service.SystemVariableService
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
...
...
@@ -90,6 +91,9 @@ public class SelfCheckController {
@Autowired
private
UnitsDao
unitsDao
;
@Autowired
private
SystemVariableService
systemVariableService
;
/**
* 月度
*/
...
...
@@ -101,16 +105,30 @@ public class SelfCheckController {
/**
* 年度
*/
private
String
cron3
=
"0 0 0 1 1 ? *"
;
/**
* 定时任务cron修改触发器的标志,1:月度,2:季度,3:年度(默认季度)
*/
private
int
tag
=
2
;
private
String
cron3
=
"0 0 0 1 1 ? "
;
private
String
cron4
=
"0 0/1 * * * ? "
;
private
final
SelfCheckSchedulerTask
selfCheckSchedulerTask
=
SpringUtils
.
getBean
(
"selfCheckSchedulerTask"
);
@ApiOperation
(
value
=
"查询自查周期"
,
notes
=
"可以通过这个接口查询自查周期"
)
@GetMapping
(
value
=
"/select/cycle"
)
public
ResponseEntity
selectCycle
(){
String
vaule
=
systemVariableService
.
getVaule
(
"selfCheckCycle"
);
if
(
"month"
.
equals
(
vaule
)){
return
ResponseEntity
.
ok
(
1
);
}
else
if
(
"quarter"
.
equals
(
vaule
)){
return
ResponseEntity
.
ok
(
2
);
}
else
if
(
"year"
.
equals
(
vaule
)){
return
ResponseEntity
.
ok
(
3
);
}
else
{
return
ResponseEntity
.
ok
(
0
);
}
}
@ApiOperation
(
value
=
"设置自查周期"
,
notes
=
"可以通过这个接口设置自查周期"
)
@PostMapping
(
value
=
"/set/cycle/{type}"
)
public
ResponseEntity
setCycle
(
@PathVariable
(
"type"
)
int
type
){
...
...
@@ -121,24 +139,32 @@ public class SelfCheckController {
ScheduledFuture
scheduledFuture
=
selfCheckSchedulerTask
.
getScheduledFuture
();
scheduledFuture
.
cancel
(
true
);
selfCheckSchedulerTask
.
startTask
();
systemVariableService
.
setVaule
(
"selfCheckCycle"
,
"month"
);
log
.
info
(
"[自查模块]:自查周期更改为月度"
);
return
ResponseEntity
.
ok
(
"自查周期更改为月度"
);
case
2
:
selfCheckSchedulerTask
.
setCron
(
cron2
);
ScheduledFuture
scheduledFuture2
=
selfCheckSchedulerTask
.
getScheduledFuture
();
scheduledFuture2
.
cancel
(
true
);
selfCheckSchedulerTask
.
startTask
();
systemVariableService
.
setVaule
(
"selfCheckCycle"
,
"quarter"
);
log
.
info
(
"[自查模块]:自查周期更改为季度"
);
return
ResponseEntity
.
ok
(
"自查周期更改为季度"
);
case
3
:
selfCheckSchedulerTask
.
setCron
(
cron3
);
ScheduledFuture
scheduledFuture3
=
selfCheckSchedulerTask
.
getScheduledFuture
();
scheduledFuture3
.
cancel
(
true
);
selfCheckSchedulerTask
.
startTask
();
systemVariableService
.
setVaule
(
"selfCheckCycle"
,
"year"
);
log
.
info
(
"[自查模块]:自查周期更改为年度"
);
return
ResponseEntity
.
ok
(
"自查周期更改为年度"
);
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"
));
...
...
@@ -264,6 +290,7 @@ public class SelfCheckController {
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[自查模块]:发起自查"
);
myWebSocket
.
sendMessage1
();
return
ResultUtil
.
success
(
selfExaminationBillEntity1
);
}
...
...
@@ -289,6 +316,7 @@ public class SelfCheckController {
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[自查模块]:审核通过自查完成"
);
myWebSocket
.
sendMessage1
();
return
ResultUtil
.
success
(
"审核通过自查完成"
);
}
...
...
@@ -306,6 +334,7 @@ public class SelfCheckController {
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[自查模块]:自查审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResultUtil
.
success
(
"自查审核失败"
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论