Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
0c1333ac
提交
0c1333ac
authored
12月 26, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(决算模块): 修改了数量问题
修改了数量问题
上级
f009b72e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
60 行增加
和
19 行删除
+60
-19
FinalCheckServiceImpl.java
...device/finalcheck/service/impl/FinalCheckServiceImpl.java
+60
-19
没有找到文件。
dev-finalcheck/src/main/java/com/tykj/dev/device/finalcheck/service/impl/FinalCheckServiceImpl.java
浏览文件 @
0c1333ac
package
com
.
tykj
.
dev
.
device
.
finalcheck
.
service
.
impl
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.config.base.DeviceLifeStatus
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.finalcheck.entity.domain.FinalDetail
;
...
...
@@ -54,8 +56,8 @@ public class FinalCheckServiceImpl implements FinalCheckService {
@Autowired
private
FinalDetailDao
detailDao
;
//
@Autowired
//
private DeviceLibraryDao deviceDao;
@Autowired
private
DeviceLibraryDao
deviceDao
;
@Autowired
private
DeviceLibraryCacheService
deviceLibraryCacheService
;
...
...
@@ -100,13 +102,31 @@ public class FinalCheckServiceImpl implements FinalCheckService {
// List<DeviceLibrary> devices = deviceDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime));
// List<DeviceLibrary> devices = deviceDao.findAll();
List
<
DeviceLibrary
>
devices
=
deviceLibraryCacheService
.
getAllDeviceLibraryList
();
//过滤出已退役,已报废,已销毁
List
<
Integer
>
statusList
=
new
ArrayList
<>(
Arrays
.
asList
(
DeviceLifeStatus
.
DESTROYED
.
id
,
DeviceLifeStatus
.
RETIRE
.
id
,
DeviceLifeStatus
.
SCRAP_I
.
id
));
PredicateBuilder
<
DeviceLibrary
>
predicateBuilder
=
Specifications
.
and
();
if
(
startTime
!=
null
){
predicateBuilder
.
gt
(
"updateTime"
,
localDateToDate
(
startTime
));
}
if
(
endTime
!=
null
){
predicateBuilder
.
lt
(
"updateTime"
,
localDateToDateEnd
(
endTime
));
}
//非在库装备
List
<
DeviceLibrary
>
outDevices
=
deviceDao
.
findAll
(
predicateBuilder
.
build
()).
stream
()
.
filter
(
deviceLibrary
->
statusList
.
contains
(
deviceLibrary
.
getLifeStatus
())).
collect
(
Collectors
.
toList
());
//在库装备
devices
=
devices
.
stream
().
filter
(
deviceLibrary
->
!
statusList
.
contains
(
deviceLibrary
.
getLifeStatus
())).
collect
(
Collectors
.
toList
());
// PredicateBuilder<DeviceLibrary> builder = Specifications.and();
// builder.eq("ownUnit",unitName);
// List<DeviceLibrary> devices = deviceDao.findAll(builder.build());
// 纵向-查 横向-0 委托-0 合计-合计 代管0 收到 发出 报废0
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
devices
.
stream
()
.
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()+
"Ǵ"
+
deviceLibrary
.
getName
()));
Map
<
String
,
List
<
DeviceLibrary
>>
outMap
=
outDevices
.
stream
()
.
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()+
"Ǵ"
+
deviceLibrary
.
getName
()));
//报废
// List<ScrapBill> scrapBills = scrapBillDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime));
...
...
@@ -124,16 +144,16 @@ public class FinalCheckServiceImpl implements FinalCheckService {
List
<
FinalDetail
>
detailList
=
new
ArrayList
<>();
//入库
Map
<
String
,
DeviceStatistics
>
storageMap
=
dataService
.
getStorageStatistics
(
localDateToDate
(
startTime
),
localDateToDate
(
endTime
))
Map
<
String
,
DeviceStatistics
>
storageMap
=
dataService
.
getStorageStatistics
(
localDateToDate
(
startTime
),
localDateToDate
End
(
endTime
))
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//送修
Map
<
String
,
DeviceStatistics
>
repairMap
=
dataService
.
getRepairStatistics
(
localDateToDate
(
startTime
),
localDateToDate
(
endTime
))
Map
<
String
,
DeviceStatistics
>
repairMap
=
dataService
.
getRepairStatistics
(
localDateToDate
(
startTime
),
localDateToDate
End
(
endTime
))
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//维修退回
Map
<
String
,
DeviceStatistics
>
repairBackMap
=
dataService
.
getRepairBackStatistics
(
localDateToDate
(
startTime
),
localDateToDate
(
endTime
))
Map
<
String
,
DeviceStatistics
>
repairBackMap
=
dataService
.
getRepairBackStatistics
(
localDateToDate
(
startTime
),
localDateToDate
End
(
endTime
))
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//销毁
...
...
@@ -154,17 +174,11 @@ public class FinalCheckServiceImpl implements FinalCheckService {
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()
+
"G"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
map
.
entrySet
())
{
List
<
DeviceLibrary
>
vList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
hList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
otherList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
v
=
new
ArrayList
<>();
String
key
=
entry
.
getKey
();
List
<
DeviceLibrary
>
v
=
entry
.
getValue
();
//纵向
List
<
DeviceLibrary
>
vList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
1
).
collect
(
Collectors
.
toList
());
//横向
List
<
DeviceLibrary
>
hList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
2
||
deviceLibrary
.
getMatchingRange
()
==
3
).
collect
(
Collectors
.
toList
());
//其他
List
<
DeviceLibrary
>
otherList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
4
).
collect
(
Collectors
.
toList
());
//收到的 入库+维修退回(中办送回)
//发出的 送修
Integer
storage
=
storageMap
.
get
(
key
)
==
null
?
0
:
storageMap
.
get
(
key
).
getNum
();
Integer
repairBack
=
repairBackMap
.
get
(
key
)
==
null
?
0
:
repairBackMap
.
get
(
key
).
getNum
();
Integer
sending
=
repairMap
.
get
(
key
)
==
null
?
0
:
repairMap
.
get
(
key
).
getNum
();
...
...
@@ -172,12 +186,39 @@ public class FinalCheckServiceImpl implements FinalCheckService {
Integer
scrap
=
scrapMap
.
get
(
key
)
==
null
?
0
:
scrapMap
.
get
(
key
).
getNum
();
Integer
destroy
=
destroyMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
Integer
loss
=
lossMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
v
=
entry
.
getValue
();
if
(!
v
.
isEmpty
()){
//纵向
vList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
1
).
collect
(
Collectors
.
toList
());
//横向
hList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
2
||
deviceLibrary
.
getMatchingRange
()
==
3
).
collect
(
Collectors
.
toList
());
//其他
otherList
=
v
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getMatchingRange
()
==
4
).
collect
(
Collectors
.
toList
());
}
//收到的 入库+维修退回(中办送回)
//发出的 送修
// detailList.add(new FinalDetail(v.get(0).getModel(), v.get(0).getName(), v.size(), 0, 0, 0, v.size(),
// 0, received, sending, 0, report.getId()));
detailList
.
add
(
new
FinalDetail
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
vList
.
size
(),
hList
.
size
(),
0
,
otherList
.
size
(),
v
.
size
(),
0
,
storage
+
repairBack
,
sending
,
scrap
,
report
.
getId
(),
loss
,
""
,
destroy
));
detailList
.
add
(
new
FinalDetail
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
vList
.
size
(),
hList
.
size
(),
0
,
otherList
.
size
(),
v
.
size
(),
0
,
storage
+
repairBack
,
sending
,
scrap
,
report
.
getId
(),
loss
,
""
,
destroy
));
}
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
outMap
.
entrySet
())
{
String
key
=
entry
.
getKey
();
if
(!
map
.
containsKey
(
key
)){
List
<
DeviceLibrary
>
v
=
new
ArrayList
<>();
Integer
storage
=
storageMap
.
get
(
key
)
==
null
?
0
:
storageMap
.
get
(
key
).
getNum
();
Integer
repairBack
=
repairBackMap
.
get
(
key
)
==
null
?
0
:
repairBackMap
.
get
(
key
).
getNum
();
Integer
sending
=
repairMap
.
get
(
key
)
==
null
?
0
:
repairMap
.
get
(
key
).
getNum
();
Integer
retire
=
retireMap
.
get
(
key
)
==
null
?
0
:
retireMap
.
get
(
key
).
getNum
();
Integer
scrap
=
scrapMap
.
get
(
key
)
==
null
?
0
:
scrapMap
.
get
(
key
).
getNum
();
Integer
destroy
=
destroyMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
Integer
loss
=
lossMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
v
=
entry
.
getValue
();
detailList
.
add
(
new
FinalDetail
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
0
,
0
,
0
,
0
,
0
,
0
,
storage
+
repairBack
,
sending
,
scrap
,
report
.
getId
(),
loss
,
""
,
destroy
));
}
}
detailList
=
detailDao
.
saveAll
(
detailList
);
return
report
.
toVo
(
detailList
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论