Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
df86e6a8
提交
df86e6a8
authored
7月 05, 2022
作者:
ljj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:重构核查快照的设计逻辑,提高查询效率
上级
5c965bca
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
85 行增加
和
4 行删除
+85
-4
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+24
-4
HistoryCheckDeviceServiceImpl.java
...firmcheck/service/impl/HistoryCheckDeviceServiceImpl.java
+5
-0
ConfirmCheckTask.java
...m/tykj/dev/device/confirmcheck/task/ConfirmCheckTask.java
+55
-0
TaskDao.java
...ain/java/com/tykj/dev/device/task/repository/TaskDao.java
+1
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
df86e6a8
...
...
@@ -19,6 +19,7 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
import
com.tykj.dev.device.confirmcheck.service.CheckUnitService
;
import
com.tykj.dev.device.confirmcheck.service.ConfirmCheckService
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
com.tykj.dev.device.confirmcheck.task.ConfirmCheckTask
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.service.FilesUtil
;
...
...
@@ -90,6 +91,10 @@ import static java.util.stream.Collectors.*;
@Api
(
tags
=
"核查模块"
,
description
=
"核查模块"
,
position
=
1
)
public
class
DeviceCheckController
{
@Autowired
private
ConfirmCheckTask
confirmCheckTask
;
final
String
CHECK_RESULT_WAIT
=
"等待省查阅"
;
final
String
CHECK_RESULT_DONE
=
"已查阅"
;
Map
<
Integer
,
String
>
desMap
=
new
HashMap
<>();
...
...
@@ -352,14 +357,27 @@ public class DeviceCheckController {
.
map
(
transUtil:
:
CheckDetailDo2Vo
)
.
orElse
(
null
);
List
<
DeviceInLibVo
>
in
=
confirmCheckTask
.
hisInLib
.
get
(
id
);
if
(
in
!=
null
)
{
detailVoList
.
setDevInLibrary
(
in
);
}
List
<
DeviceNotInLibVo
>
notIn
=
confirmCheckTask
.
hisNotInLib
.
get
(
id
);
if
(
notIn
!=
null
)
{
detailVoList
.
setDevNotInLibrary
(
notIn
);
}
if
(
in
==
null
&&
notIn
==
null
)
{
// 理论上不会走到这一步
long
secondTime
=
System
.
currentTimeMillis
();
CheckDetailVo
checkDetailVo
=
historyCheckDeviceService
.
replayHistoryDevice
(
detailVoList
,
id
);
log
.
info
(
"[check] 查询快照的时间:{}"
,
System
.
currentTimeMillis
()
-
secondTime
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
checkDetailVo
));
}
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
detailVoList
));
}
/**
* 阅知
*
...
...
@@ -480,8 +498,8 @@ public class DeviceCheckController {
CheckDetailVo
cdVo
=
transUtil
.
CheckDetailDo2Vo
(
detail
);
// 查询快照
CheckDetailVo
rs
=
historyCheckDeviceService
.
replayHistoryDevice
(
cdVo
,
id
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
rs
));
//
CheckDetailVo rs = historyCheckDeviceService.replayHistoryDevice(cdVo, id);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
cdVo
));
}
/**
...
...
@@ -857,7 +875,6 @@ public class DeviceCheckController {
String
detailString
=
transUtil
.
devLib2String
(
devLibVo
.
getDevInLibrary
(),
devLibVo
.
getDevNotInLibrary
());
// 这边要根据检查信息,生成装备的历史记录
historyCheckDeviceService
.
createHistoryDevice
(
detailString
,
id
);
User
currentUser
=
Objects
.
requireNonNull
(
authenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
long
count
=
devLibVo
.
getDevInLibrary
().
stream
()
...
...
@@ -870,6 +887,9 @@ public class DeviceCheckController {
taskService
.
moveToNext
(
currentTask
,
assignUserId
);
log
.
info
(
"[核查模块] A岗核查操作成功"
);
historyCheckDeviceService
.
createHistoryDevice
(
detailString
,
id
);
//3.将父级以及父级的父级的状态更改为正在进行 找到父级的stat对象
Integer
fatherId
=
currentTask
.
getParentTaskId
();
Task
cityTask
=
taskRepo
.
findById
(
fatherId
).
get
();
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/impl/HistoryCheckDeviceServiceImpl.java
浏览文件 @
df86e6a8
...
...
@@ -8,6 +8,7 @@ import com.tykj.dev.device.confirmcheck.entity.vo.DeviceNotInLibVo;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.confirmcheck.repository.HistoryCheckDeviceDao
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
com.tykj.dev.device.confirmcheck.task.ConfirmCheckTask
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -27,6 +28,8 @@ import java.util.stream.Collectors;
@Slf4j
public
class
HistoryCheckDeviceServiceImpl
implements
HistoryCheckDeviceService
{
@Autowired
private
ConfirmCheckTask
confirmCheckTask
;
@Autowired
private
HistoryCheckDeviceDao
historyCheckDeviceDao
;
@Autowired
...
...
@@ -83,6 +86,8 @@ public class HistoryCheckDeviceServiceImpl implements HistoryCheckDeviceService
rs
.
add
(
build
);
}
historyCheckDeviceDao
.
saveAll
(
rs
);
confirmCheckTask
.
extracted
(
detailId
);
}
}
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/task/ConfirmCheckTask.java
浏览文件 @
df86e6a8
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
task
;
import
com.tykj.dev.device.confirmcheck.controller.DeviceCheckController
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.HistoryCheckDevice
;
import
com.tykj.dev.device.confirmcheck.entity.vo.CheckDetailVo
;
import
com.tykj.dev.device.confirmcheck.entity.vo.DeviceInLibVo
;
import
com.tykj.dev.device.confirmcheck.entity.vo.DeviceNotInLibVo
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.confirmcheck.repository.HistoryCheckDeviceDao
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
com.tykj.dev.device.confirmcheck.service.impl.HistoryCheckDeviceServiceImpl
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/24
...
...
@@ -16,6 +31,18 @@ public class ConfirmCheckTask implements CommandLineRunner {
@Autowired
private
HistoryCheckDeviceService
historyCheckDeviceService
;
@Autowired
private
HistoryCheckDeviceDao
historyCheckDeviceDao
;
@Autowired
private
DeviceCheckDetailDao
detailDao
;
@Autowired
private
ObjTransUtil
transUtil
;
@Autowired
private
TaskDao
taskDao
;
public
Map
<
Integer
,
List
<
DeviceInLibVo
>>
hisInLib
=
new
HashMap
<>();;
public
Map
<
Integer
,
List
<
DeviceNotInLibVo
>>
hisNotInLib
=
new
HashMap
<>();;
@Override
public
void
run
(
String
...
args
)
{
...
...
@@ -24,5 +51,33 @@ public class ConfirmCheckTask implements CommandLineRunner {
// historyCheckDeviceService.fixHistoryDevice();
// log.info("[check] 纠正核查历史装备数据完成,用时:{}ms", System.currentTimeMillis() - start);
log
.
info
(
"[check] 启动加载完结的账单信息"
);
long
startTime
=
System
.
currentTimeMillis
();
List
<
Task
>
tasks
=
taskDao
.
findAllByBusinessTypeAndBillStatusNotIn
(
8
,
Arrays
.
asList
(
140
,
160
));
for
(
Task
task
:
tasks
)
{
extracted
(
task
.
getBillId
());
}
log
.
info
(
"[check] 加载账单快照用时:{}ms"
,
System
.
currentTimeMillis
()
-
startTime
);
}
public
void
extracted
(
Integer
billId
)
{
Optional
<
DeviceCheckDetail
>
byId
=
detailDao
.
findById
(
billId
);
if
(
byId
.
isPresent
())
{
DeviceCheckDetail
deviceCheckDetail
=
byId
.
get
();
CheckDetailVo
checkDetailVo
=
transUtil
.
CheckDetailDo2Vo
(
deviceCheckDetail
);
CheckDetailVo
vo2
=
historyCheckDeviceService
.
replayHistoryDevice
(
checkDetailVo
,
deviceCheckDetail
.
getId
());
List
<
DeviceInLibVo
>
devInLibrary
=
vo2
.
getDevInLibrary
();
List
<
DeviceNotInLibVo
>
devNotInLibrary
=
vo2
.
getDevNotInLibrary
();
hisInLib
.
put
(
deviceCheckDetail
.
getId
(),
devInLibrary
);
hisNotInLib
.
put
(
deviceCheckDetail
.
getId
(),
devNotInLibrary
);
}
}
}
dev-task/src/main/java/com/tykj/dev/device/task/repository/TaskDao.java
浏览文件 @
df86e6a8
...
...
@@ -90,6 +90,7 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List
<
Task
>
findAllByBusinessType
(
Integer
businessType
);
List
<
Task
>
findAllByBusinessTypeAndBillStatus
(
Integer
businessType
,
Integer
billStatus
);
List
<
Task
>
findAllByBusinessTypeAndBillStatusNotIn
(
Integer
businessType
,
List
<
Integer
>
billStatus
);
List
<
Task
>
findAllByBillIdInAndBusinessType
(
List
<
Integer
>
ids
,
Integer
type
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论