Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
bc5e46b3
提交
bc5e46b3
authored
5月 25, 2022
作者:
ljj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[check] 核查添加历史记录
上级
ece3b0d3
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
377 行增加
和
11 行删除
+377
-11
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+45
-9
HistoryCheckDevice.java
...device/confirmcheck/entity/domain/HistoryCheckDevice.java
+66
-0
HistoryCheckDeviceDao.java
...device/confirmcheck/repository/HistoryCheckDeviceDao.java
+34
-0
ConfirmCheckService.java
.../dev/device/confirmcheck/service/ConfirmCheckService.java
+7
-0
HistoryCheckDeviceService.java
...evice/confirmcheck/service/HistoryCheckDeviceService.java
+37
-0
ConfirmCheckServiceImpl.java
...ce/confirmcheck/service/impl/ConfirmCheckServiceImpl.java
+7
-1
HistoryCheckDeviceServiceImpl.java
...firmcheck/service/impl/HistoryCheckDeviceServiceImpl.java
+146
-0
ConfirmCheckTask.java
...m/tykj/dev/device/confirmcheck/task/ConfirmCheckTask.java
+28
-0
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+4
-0
PackingLibraryServiceImpl.java
...evice/packing/service/impl/PackingLibraryServiceImpl.java
+3
-1
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
bc5e46b3
...
@@ -13,6 +13,7 @@ import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
...
@@ -13,6 +13,7 @@ import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckLink
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckLink
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.domain.HistoryCheckDevice
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
...
@@ -20,6 +21,7 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckLinkDao;
...
@@ -20,6 +21,7 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckLinkDao;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao
;
import
com.tykj.dev.device.confirmcheck.service.CheckUnitService
;
import
com.tykj.dev.device.confirmcheck.service.CheckUnitService
;
import
com.tykj.dev.device.confirmcheck.service.ConfirmCheckService
;
import
com.tykj.dev.device.confirmcheck.service.ConfirmCheckService
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.confirmcheck.utils.ObjTransUtil
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.file.service.FilesUtil
;
...
@@ -152,6 +154,8 @@ public class DeviceCheckController {
...
@@ -152,6 +154,8 @@ public class DeviceCheckController {
private
CheckUnitService
checkUnitService
;
private
CheckUnitService
checkUnitService
;
@Autowired
@Autowired
private
TaskLogDao
taskLogDao
;
private
TaskLogDao
taskLogDao
;
@Autowired
private
HistoryCheckDeviceService
historyCheckDeviceService
;
@GetMapping
(
"/escow/taskLog"
)
@GetMapping
(
"/escow/taskLog"
)
...
@@ -352,7 +356,7 @@ public class DeviceCheckController {
...
@@ -352,7 +356,7 @@ public class DeviceCheckController {
CheckDetailVo
detailVoList
=
detailRepo
.
findById
(
id
)
CheckDetailVo
detailVoList
=
detailRepo
.
findById
(
id
)
.
map
(
transUtil:
:
CheckDetailDo2Vo
)
.
map
(
transUtil:
:
CheckDetailDo2Vo
)
.
orElse
(
null
);
.
orElse
(
null
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
detailVoList
));
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
historyCheckDeviceService
.
replayHistoryDevice
(
detailVoList
,
id
)
));
}
}
/**
/**
...
@@ -377,15 +381,21 @@ public class DeviceCheckController {
...
@@ -377,15 +381,21 @@ public class DeviceCheckController {
@ApiOperation
(
value
=
"根据id查询核查详情数据"
,
notes
=
"可以通过这个接口查询核查详情数据"
)
@ApiOperation
(
value
=
"根据id查询核查详情数据"
,
notes
=
"可以通过这个接口查询核查详情数据"
)
@PostMapping
(
"/detail/unit/{unitId}"
)
@PostMapping
(
"/detail/unit/{unitId}"
)
public
ResponseEntity
findDetailsByUnitId
(
@PathVariable
Integer
unitId
,
public
ResponseEntity
findDetailsByUnitId
(
@PathVariable
Integer
unitId
,
@RequestBody
CheckBillSelectVo
checkBillSelectVo
)
{
@RequestBody
CheckBillSelectVo
checkBillSelectVo
)
{
Specification
<
DeviceCheckDetail
>
pred
=
Specifications
.<
DeviceCheckDetail
>
and
()
Specification
<
DeviceCheckDetail
>
pred
=
Specifications
.<
DeviceCheckDetail
>
and
()
.
eq
(
"checkUnitId"
,
unitId
)
.
eq
(
"checkUnitId"
,
unitId
)
.
build
();
.
build
();
List
<
CheckDetailVo
>
detailVoList
=
detailRepo
.
findAll
(
pred
,
checkBillSelectVo
.
getPageable
()).
stream
()
Page
<
DeviceCheckDetail
>
all
=
detailRepo
.
findAll
(
pred
,
checkBillSelectVo
.
getPageable
());
long
total
=
all
.
getTotalElements
();
List
<
CheckDetailVo
>
detailVoList
=
all
.
stream
()
.
map
(
transUtil:
:
CheckDetailDo2Vo
)
.
map
(
transUtil:
:
CheckDetailDo2Vo
)
.
collect
(
toList
());
.
collect
(
toList
());
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
detailVoList
));
ResultObj
<
List
<
CheckDetailVo
>>
listResultObj
=
new
ResultObj
<>(
detailVoList
);
// 前期设计问题,因此,将分页的总数直接丢message里给到前端
listResultObj
.
setMessage
(
total
+
""
);
return
ResponseEntity
.
ok
(
listResultObj
);
}
}
@GetMapping
(
"/detail/refresh/remove/{checkId}/{detailId}"
)
@GetMapping
(
"/detail/refresh/remove/{checkId}/{detailId}"
)
...
@@ -467,8 +477,9 @@ public class DeviceCheckController {
...
@@ -467,8 +477,9 @@ public class DeviceCheckController {
detail
=
detailRepo
.
save
(
detail
);
detail
=
detailRepo
.
save
(
detail
);
CheckDetailVo
cdVo
=
transUtil
.
CheckDetailDo2Vo
(
detail
);
CheckDetailVo
cdVo
=
transUtil
.
CheckDetailDo2Vo
(
detail
);
CheckDetailVo
rs
=
historyCheckDeviceService
.
replayHistoryDevice
(
cdVo
,
id
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
cdVo
));
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
rs
));
}
}
/**
/**
...
@@ -715,7 +726,7 @@ public class DeviceCheckController {
...
@@ -715,7 +726,7 @@ public class DeviceCheckController {
linkVo
.
setLcDetail
(
lcdList
);
linkVo
.
setLcDetail
(
lcdList
);
linkVo
.
setLeDetail
(
ledList
);
linkVo
.
setLeDetail
(
ledList
);
if
(
linkVo
.
getLeDetail
()
!=
null
&&
linkVo
.
getLeDetail
().
size
()
!=
0
)
{
if
(
linkVo
.
getLeDetail
()
!=
null
&&
linkVo
.
getLeDetail
().
size
()
!=
0
)
{
long
count
=
linkVo
.
getLeDetail
().
stream
().
filter
(
o
->
o
.
getCheckSituation
()
==
"完成"
).
count
();
long
count
=
linkVo
.
getLeDetail
().
stream
().
filter
(
o
->
o
.
getCheckSituation
()
==
"完成"
).
count
();
if
(
count
==
linkVo
.
getLeDetail
().
size
())
{
if
(
count
==
linkVo
.
getLeDetail
().
size
())
{
linkVo
.
setShutDown
(
true
);
linkVo
.
setShutDown
(
true
);
...
@@ -842,6 +853,10 @@ public class DeviceCheckController {
...
@@ -842,6 +853,10 @@ public class DeviceCheckController {
//1. 更新checkDetail
//1. 更新checkDetail
log
.
info
(
"[核查模块] 专管员A正在进行详情账单核查,且指定下一个审核人B id 为 {}"
,
assignUserId
);
log
.
info
(
"[核查模块] 专管员A正在进行详情账单核查,且指定下一个审核人B id 为 {}"
,
assignUserId
);
String
detailString
=
transUtil
.
devLib2String
(
devLibVo
.
getDevInLibrary
(),
devLibVo
.
getDevNotInLibrary
());
String
detailString
=
transUtil
.
devLib2String
(
devLibVo
.
getDevInLibrary
(),
devLibVo
.
getDevNotInLibrary
());
// 这边要根据检查信息,生成装备的历史记录
historyCheckDeviceService
.
createHistoryDevice
(
detailString
,
id
);
User
currentUser
=
Objects
.
requireNonNull
(
authenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
User
currentUser
=
Objects
.
requireNonNull
(
authenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
long
count
=
devLibVo
.
getDevInLibrary
().
stream
()
long
count
=
devLibVo
.
getDevInLibrary
().
stream
()
.
filter
(
deviceInLibVo
->
deviceInLibVo
.
getProofResult
()
%
10
!=
9
)
.
filter
(
deviceInLibVo
->
deviceInLibVo
.
getProofResult
()
%
10
!=
9
)
...
@@ -1060,6 +1075,14 @@ public class DeviceCheckController {
...
@@ -1060,6 +1075,14 @@ public class DeviceCheckController {
currentDetail
.
setCheckFileList
(
Lists
.
newArrayList
());
currentDetail
.
setCheckFileList
(
Lists
.
newArrayList
());
Integer
userId
=
authenticationUtils
.
getAuthentication
().
getCurrentUserInfo
().
getUserId
();
Integer
userId
=
authenticationUtils
.
getAuthentication
().
getCurrentUserInfo
().
getUserId
();
currentDetail
.
setUserCId
(
0
);
currentDetail
.
setUserCId
(
0
);
currentDetail
.
setCheckResult
(
""
);
currentDetail
.
setCheckedCount
(
0
);
currentDetail
.
setUserAId
(
0
);
currentDetail
.
setUserBId
(
0
);
currentDetail
.
setUserCId
(
0
);
currentDetail
.
setCheckUserAId
(
0
);
currentDetail
.
setCheckUserBId
(
0
);
currentDetail
.
setCheckEName
(
""
);
currentDetail
=
detailRepo
.
save
(
currentDetail
);
currentDetail
=
detailRepo
.
save
(
currentDetail
);
//该detail对应的stat数据里相应的数据剔除(写一个通用的剔除方法), 否则在第二次审核通过的时候会重复计算一次数据
//该detail对应的stat数据里相应的数据剔除(写一个通用的剔除方法), 否则在第二次审核通过的时候会重复计算一次数据
...
@@ -1183,9 +1206,21 @@ public class DeviceCheckController {
...
@@ -1183,9 +1206,21 @@ public class DeviceCheckController {
taskService
.
moveToSpecial
(
c1
.
parse2Bto
(),
CHECK_SHUT_DOWN
);
taskService
.
moveToSpecial
(
c1
.
parse2Bto
(),
CHECK_SHUT_DOWN
);
supplyLogMsg
(
c1
);
supplyLogMsg
(
c1
);
List
<
Task
>
c2Childs
=
taskRepo
.
findAllByParentTaskId
(
c1
.
getId
());
List
<
Task
>
c2Childs
=
taskRepo
.
findAllByParentTaskId
(
c1
.
getId
());
c2Childs
.
forEach
(
c2
->
shutDownNode
(
c2
));
c2Childs
.
forEach
(
c2
->
{
shutDownNode
(
c2
);
Optional
<
DeviceCheckDetail
>
opDeatil
=
detailRepo
.
findById
(
c2
.
getBillId
());
if
((
c2
.
getBillStatus
()
==
160
||
c2
.
getBillStatus
()
==
140
)
&&
c2
.
getBusinessType
()
==
8
&&
opDeatil
.
isPresent
())
{
log
.
info
(
"[check] 终结状态为160或140的detail任务(billId={})时,记录当前装备的状态"
,
c2
.
getBillId
());
historyCheckDeviceService
.
createHistoryDevice
(
opDeatil
.
get
().
getCheckDetail
(),
opDeatil
.
get
().
getId
());
}
});
}
else
{
}
else
{
shutDownNode
(
c1
);
shutDownNode
(
c1
);
Optional
<
DeviceCheckDetail
>
opDeatil
=
detailRepo
.
findById
(
c1
.
getBillId
());
if
((
c1
.
getBillStatus
()
==
160
||
c1
.
getBillStatus
()
==
140
)
&&
c1
.
getBusinessType
()
==
8
&&
opDeatil
.
isPresent
())
{
log
.
info
(
"[check] 终结状态为160或140的detail任务(billId={})时,记录当前装备的状态"
,
c1
.
getBillId
());
historyCheckDeviceService
.
createHistoryDevice
(
opDeatil
.
get
().
getCheckDetail
(),
opDeatil
.
get
().
getId
());
}
}
}
}
}
...
@@ -1638,7 +1673,8 @@ public class DeviceCheckController {
...
@@ -1638,7 +1673,8 @@ public class DeviceCheckController {
// 1.将该任务进度推进至9999
// 1.将该任务进度推进至9999
TaskBto
nodeBto
=
node
.
parse2Bto
();
TaskBto
nodeBto
=
node
.
parse2Bto
();
taskService
.
moveToEnd
(
nodeBto
);
taskService
.
moveToEnd
(
nodeBto
);
// supplyLogMsg(node);
// // TODO: 2022/5/23
supplyLogMsg
(
node
);
log
.
info
(
"[核查模块] 终止任务-task id = {} 成功关闭"
);
log
.
info
(
"[核查模块] 终止任务-task id = {} 成功关闭"
);
}
}
...
@@ -1749,7 +1785,7 @@ public class DeviceCheckController {
...
@@ -1749,7 +1785,7 @@ public class DeviceCheckController {
cDetail
.
setCheckFileList
(
Lists
.
newArrayList
());
cDetail
.
setCheckFileList
(
Lists
.
newArrayList
());
cDetail
.
setReview
(
false
);
cDetail
.
setReview
(
false
);
cDetail
.
setUserAId
(
0
);
cDetail
.
setUserAId
(
0
);
cDetail
.
setUser
A
Id
(
0
);
cDetail
.
setUser
B
Id
(
0
);
cDetail
.
setUserCId
(
0
);
cDetail
.
setUserCId
(
0
);
cDetail
.
setCheckEName
(
""
);
cDetail
.
setCheckEName
(
""
);
cDetail
.
setCheckResult
(
""
);
cDetail
.
setCheckResult
(
""
);
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/domain/HistoryCheckDevice.java
0 → 100644
浏览文件 @
bc5e46b3
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
domain
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
javax.persistence.*
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/23
*/
@SuppressWarnings
(
"AlibabaLowerCamelCaseVariableNaming"
)
@Data
@Entity
@SQLDelete
(
sql
=
"update device_check_stat set delete_tag = 1 where id = ?"
)
@ApiModel
(
"核查详情历史统计装备"
)
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"device_history_device"
)
@Builder
public
class
HistoryCheckDevice
{
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty
(
name
=
"主键id"
)
@Column
(
columnDefinition
=
"integer NOT NULL AUTO_INCREMENT"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"核查detail 对象的id"
)
private
Integer
detailId
;
@ApiModelProperty
(
value
=
"装备id"
)
private
Integer
deviceLibraryId
;
@ApiModelProperty
(
value
=
"型号"
)
private
String
model
;
@ApiModelProperty
(
value
=
"装备名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"装备序列号"
)
private
String
seqNumber
;
@ApiModelProperty
(
value
=
"rfid卡号"
)
private
String
rfidCardId
;
@ApiModelProperty
(
value
=
"所在单位"
)
private
String
locationUnit
;
@ApiModelProperty
(
value
=
"所属单位"
)
private
String
ownUnit
;
@ApiModelProperty
(
value
=
"生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失"
)
private
Integer
lifeStatus
;
@ApiModelProperty
(
value
=
"生命状态"
)
private
String
lifeStatusName
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/repository/HistoryCheckDeviceDao.java
0 → 100644
浏览文件 @
bc5e46b3
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
repository
;
import
com.tykj.dev.device.confirmcheck.entity.domain.HistoryCheckDevice
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/23
*/
public
interface
HistoryCheckDeviceDao
extends
JpaRepository
<
HistoryCheckDevice
,
Integer
>,
JpaSpecificationExecutor
<
HistoryCheckDevice
>
{
/**
* 根据detailId查询所有历史装备信息
* @param detailId detail信息
* @return 历史装备集合
*/
Optional
<
List
<
HistoryCheckDevice
>>
findAllByDetailId
(
Integer
detailId
);
/**
* 根据账单和装备id查询
* @param detailId
* @param deviceLibraryId
* @return
*/
@Query
(
value
=
"select * from device_history_device where DETAIL_ID = ?1 and DEVICE_LIBRARY_ID = ?2"
,
nativeQuery
=
true
)
List
<
HistoryCheckDevice
>
findAllByDetailIdAndDeviceLibraryId
(
Integer
detailId
,
Integer
deviceLibraryId
);
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/ConfirmCheckService.java
浏览文件 @
bc5e46b3
...
@@ -85,4 +85,11 @@ public interface ConfirmCheckService {
...
@@ -85,4 +85,11 @@ public interface ConfirmCheckService {
* DeviceCheckStat异步上链
* DeviceCheckStat异步上链
*/
*/
void
sendHash3
(
List
<
DeviceCheckStat
>
deviceCheckStats
);
void
sendHash3
(
List
<
DeviceCheckStat
>
deviceCheckStats
);
/**
* 根据task id
* @param taskId
* @return
*/
List
<
Integer
>
findAllDetailByTaskId
(
Integer
taskId
);
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/HistoryCheckDeviceService.java
0 → 100644
浏览文件 @
bc5e46b3
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
service
;
import
com.tykj.dev.device.confirmcheck.entity.domain.HistoryCheckDevice
;
import
com.tykj.dev.device.confirmcheck.entity.vo.CheckDetailVo
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/23
*/
public
interface
HistoryCheckDeviceService
{
/**
* 保存历史装备
* @param historyCheckDevice 历史装备信息
* @return 保存后的历史装备
*/
HistoryCheckDevice
saveOne
(
HistoryCheckDevice
historyCheckDevice
);
/**
* 替换掉在库/非在库的装备信息为历史的信息
* @param checkDetailVo 需替换的对象
* @param detailId 详情的id
* @return 替换掉后的对象
*/
CheckDetailVo
replayHistoryDevice
(
CheckDetailVo
checkDetailVo
,
Integer
detailId
);
/**
* 根据check_detail 的信息生成历史记录
* @param detailStr check_detail 信息
*/
void
createHistoryDevice
(
String
detailStr
,
Integer
detailId
);
/**
* 纠正历史核查记录
*/
void
fixHistoryDevice
();
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/impl/ConfirmCheckServiceImpl.java
浏览文件 @
bc5e46b3
...
@@ -338,7 +338,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
...
@@ -338,7 +338,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
.
map
(
TaskBto:
:
getBillId
)
.
map
(
TaskBto:
:
getBillId
)
.
collect
(
toList
());
.
collect
(
toList
());
List
<
CheckStatTableVo
>
tableVos
=
statDao
.
findAll
(
checkBillSelectVo
.
getPageable
().
getSort
()).
stream
()
List
<
CheckStatTableVo
>
tableVos
=
statDao
.
findAll
(
checkBillSelectVo
.
getPageable
().
getSort
())
.
stream
()
.
map
(
objTransUtil:
:
stat2TableVo
)
.
map
(
objTransUtil:
:
stat2TableVo
)
.
filter
(
vo
->
keywordFilter
(
vo
,
checkBillSelectVo
.
getKeyword
()))
.
filter
(
vo
->
keywordFilter
(
vo
,
checkBillSelectVo
.
getKeyword
()))
.
filter
(
v
->
topIdList
.
contains
(
v
.
getId
()))
.
filter
(
v
->
topIdList
.
contains
(
v
.
getId
()))
...
@@ -525,6 +526,11 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
...
@@ -525,6 +526,11 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
});
});
}
}
@Override
public
List
<
Integer
>
findAllDetailByTaskId
(
Integer
taskId
)
{
return
null
;
}
/**
/**
* 关键字过滤器
* 关键字过滤器
*
*
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/impl/HistoryCheckDeviceServiceImpl.java
0 → 100644
浏览文件 @
bc5e46b3
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
service
.
impl
;
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.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/23
*/
@Service
@Slf4j
public
class
HistoryCheckDeviceServiceImpl
implements
HistoryCheckDeviceService
{
@Autowired
private
HistoryCheckDeviceDao
historyCheckDeviceDao
;
@Autowired
private
DeviceLibraryService
deviceLibraryService
;
@Autowired
private
DeviceCheckDetailDao
detailDao
;
@Override
public
HistoryCheckDevice
saveOne
(
HistoryCheckDevice
historyCheckDevice
)
{
return
historyCheckDeviceDao
.
save
(
historyCheckDevice
);
}
@Override
public
CheckDetailVo
replayHistoryDevice
(
CheckDetailVo
checkDetailVo
,
Integer
detailId
)
{
// 更新在库装备
updateDevInLib
(
checkDetailVo
.
getDevInLibrary
(),
detailId
);
updateDevNotInLib
(
checkDetailVo
.
getDevNotInLibrary
(),
detailId
);
return
checkDetailVo
;
}
@Override
public
void
createHistoryDevice
(
String
detailStr
,
Integer
detailId
)
{
String
[]
split
=
detailStr
.
split
(
","
);
if
(
split
.
length
>
0
)
{
List
<
HistoryCheckDevice
>
rs
=
new
ArrayList
<>();
for
(
String
s
:
split
)
{
if
(
""
.
equals
(
s
))
{
continue
;
}
String
[]
id
=
s
.
split
(
"-"
);
List
<
Integer
>
ids
=
new
ArrayList
<>();
ids
.
add
(
Integer
.
parseInt
(
id
[
0
]));
List
<
DeviceLibrary
>
byIds
=
deviceLibraryService
.
findByIds
(
ids
);
if
(
byIds
.
size
()
<
1
)
{
continue
;
}
DeviceLibrary
dev
=
byIds
.
get
(
0
).
setConfigName
();
HistoryCheckDevice
build
=
HistoryCheckDevice
.
builder
()
.
detailId
(
detailId
)
.
deviceLibraryId
(
Integer
.
parseInt
(
id
[
0
]))
.
model
(
dev
.
getModel
())
.
name
(
dev
.
getName
())
.
seqNumber
(
dev
.
getSeqNumber
())
.
rfidCardId
(
dev
.
getRfidCardId
())
.
locationUnit
(
dev
.
getLocationUnit
())
.
ownUnit
(
dev
.
getOwnUnit
())
.
lifeStatus
(
dev
.
getLifeStatus
())
.
lifeStatusName
(
dev
.
getLifeStatusName
())
.
build
();
rs
.
add
(
build
);
}
historyCheckDeviceDao
.
saveAll
(
rs
);
}
}
@Override
public
void
fixHistoryDevice
()
{
List
<
DeviceCheckDetail
>
all
=
detailDao
.
findAll
();
for
(
DeviceCheckDetail
deviceCheckDetail
:
all
)
{
Optional
<
List
<
HistoryCheckDevice
>>
allByDetailId
=
historyCheckDeviceDao
.
findAllByDetailId
(
deviceCheckDetail
.
getId
());
if
(!
allByDetailId
.
isPresent
())
{
log
.
info
(
"[check] 发现需要修正的detail({}),开始生成历史记录"
,
deviceCheckDetail
.
getId
());
createHistoryDevice
(
deviceCheckDetail
.
getCheckDetail
(),
deviceCheckDetail
.
getId
());
}
}
}
private
List
<
DeviceInLibVo
>
updateDevInLib
(
List
<
DeviceInLibVo
>
devInLibrary
,
Integer
detailId
)
{
for
(
DeviceInLibVo
deviceInLibVo
:
devInLibrary
)
{
List
<
HistoryCheckDevice
>
hiss
=
historyCheckDeviceDao
.
findAllByDetailIdAndDeviceLibraryId
(
detailId
,
deviceInLibVo
.
getId
());
if
(
hiss
==
null
||
hiss
.
size
()
!=
1
)
{
log
.
warn
(
"[check] 核查的历史账单中发现错误数据,错误的装备id:{}"
,
deviceInLibVo
.
getId
());
continue
;
}
HistoryCheckDevice
his
=
hiss
.
get
(
0
);
deviceInLibVo
.
setModel
(
his
.
getModel
());
deviceInLibVo
.
setName
(
his
.
getName
());
deviceInLibVo
.
setSeqNumber
(
his
.
getSeqNumber
());
deviceInLibVo
.
setRfidCardId
(
his
.
getRfidCardId
());
deviceInLibVo
.
setLocationUnit
(
his
.
getLocationUnit
());
deviceInLibVo
.
setOwnUnit
(
his
.
getOwnUnit
());
deviceInLibVo
.
setLifeStatusName
(
his
.
getLifeStatusName
());
}
return
devInLibrary
;
}
private
List
<
DeviceNotInLibVo
>
updateDevNotInLib
(
List
<
DeviceNotInLibVo
>
devNotInLibrary
,
Integer
detailId
)
{
for
(
DeviceNotInLibVo
deviceNotInLibVo
:
devNotInLibrary
)
{
List
<
HistoryCheckDevice
>
hiss
=
historyCheckDeviceDao
.
findAllByDetailIdAndDeviceLibraryId
(
detailId
,
deviceNotInLibVo
.
getId
());
if
(
hiss
==
null
||
hiss
.
size
()
!=
1
)
{
log
.
warn
(
"[check] 核查的历史账单中发现错误数据,错误的装备id:{}"
,
deviceNotInLibVo
.
getId
());
continue
;
}
HistoryCheckDevice
his
=
hiss
.
get
(
0
);
deviceNotInLibVo
.
setModel
(
his
.
getModel
());
deviceNotInLibVo
.
setName
(
his
.
getName
());
deviceNotInLibVo
.
setSeqNumber
(
his
.
getSeqNumber
());
deviceNotInLibVo
.
setRfidCardId
(
his
.
getRfidCardId
());
deviceNotInLibVo
.
setLocationUnit
(
his
.
getLocationUnit
());
deviceNotInLibVo
.
setOwnUnit
(
his
.
getOwnUnit
());
deviceNotInLibVo
.
setLifeStatusName
(
his
.
getLifeStatusName
());
}
return
devNotInLibrary
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/task/ConfirmCheckTask.java
0 → 100644
浏览文件 @
bc5e46b3
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
task
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
/**
* @author: cnljj1995@gmail.com
* @Date: 2022/5/24
*/
@Component
@Slf4j
public
class
ConfirmCheckTask
implements
CommandLineRunner
{
@Autowired
private
HistoryCheckDeviceService
historyCheckDeviceService
;
@Override
public
void
run
(
String
...
args
)
{
log
.
info
(
"[check] 核查纠正历史装备数据..."
);
long
start
=
System
.
currentTimeMillis
();
historyCheckDeviceService
.
fixHistoryDevice
();
log
.
info
(
"[check] 纠正核查历史装备数据完成,用时:{}ms"
,
System
.
currentTimeMillis
()
-
start
);
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
bc5e46b3
...
@@ -9,6 +9,7 @@ import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill;
...
@@ -9,6 +9,7 @@ import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.confirmcheck.repository.HistoryCheckDeviceDao
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
...
@@ -86,6 +87,9 @@ public class ObjTransUtil {
...
@@ -86,6 +87,9 @@ public class ObjTransUtil {
@Autowired
@Autowired
private
PackingLibraryService
packingLibraryService
;
private
PackingLibraryService
packingLibraryService
;
@Autowired
private
HistoryCheckDeviceDao
historyCheckDeviceDao
;
/**
/**
* 装备转化为初始化的装备统计类
* 装备转化为初始化的装备统计类
...
...
dev-packing/src/main/java/com/tykj/dev/device/packing/service/impl/PackingLibraryServiceImpl.java
浏览文件 @
bc5e46b3
...
@@ -552,7 +552,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
...
@@ -552,7 +552,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
script
.
setNum
(
deviceLibraryList
.
size
());
script
.
setNum
(
deviceLibraryList
.
size
());
script
.
setAllotType
(
packingLibrary
.
getMatchingRangeName
());
script
.
setAllotType
(
packingLibrary
.
getMatchingRangeName
());
script
.
setAllotTypeNum
(
packingLibrary
.
getMatchingRange
());
script
.
setAllotTypeNum
(
packingLibrary
.
getMatchingRange
());
script
.
setSeqNumber
(
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
deviceLibraryList
.
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
()))));
script
.
setSeqNumber
(
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
deviceLibraryList
.
stream
()
.
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
()))));
scripts
.
add
(
script
);
scripts
.
add
(
script
);
}
}
Map
<
Integer
,
Script
>
nodeCollect
=
Map
<
Integer
,
Script
>
nodeCollect
=
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论