Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
52a09525
提交
52a09525
authored
11月 14, 2022
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(自查模块): 修改自查
修改自查
上级
b42e0d47
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
225 行增加
和
1 行删除
+225
-1
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+21
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+9
-0
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+192
-1
DeviceLibrarySelectVo.java
.../dev/device/library/subject/vo/DeviceLibrarySelectVo.java
+3
-0
没有找到文件。
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
浏览文件 @
52a09525
...
...
@@ -643,6 +643,27 @@ public class DeviceLibraryController {
map
.
put
(
"types"
,
types
.
stream
().
map
(
integer
->
new
TypeVo
(
integer
,
styleMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
return
ResultUtil
.
success
(
map
);
}
@ApiOperation
(
value
=
"模糊查询核心装备统计分页(可以勾选多个单位)"
,
notes
=
"可以通过这个接口查询装备列表,全省设备库"
)
@PostMapping
(
"/core/stat/summary/unitList"
)
public
ResponseEntity
getDeviceStatisticsPageUnitList
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
List
<
DeviceStatisticsVo
>
deviceStatisticsVoList
=
deviceLibraryService
.
getDeviceStatisticsPage1
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
(),
deviceLibrarySelectVo
.
getPageable
().
getSort
());
List
<
DeviceStatisticsVo
>
deviceStatisticsVoSorts
=
deviceStatisticsVoList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
DeviceStatisticsVo:
:
getModel
).
thenComparing
(
DeviceStatisticsVo:
:
getName
)).
collect
(
Collectors
.
toList
());
Page
<
DeviceStatisticsVo
>
deviceStatisticsVos
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
deviceStatisticsVoSorts
,
deviceLibrarySelectVo
.
getPageable
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
Integer
,
String
>
styleMap
=
configCache
.
getStyleMap
();
List
<
String
>
models
=
deviceStatisticsVoList
.
stream
().
map
(
DeviceStatisticsVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
modelToSort
=
DeviceModelSort
.
modelToSort
(
models
);
map
.
put
(
"pages"
,
deviceStatisticsVos
);
map
.
put
(
"models"
,
modelToSort
);
//名称排序
map
.
put
(
"names"
,
deviceStatisticsVoList
.
stream
().
map
(
DeviceStatisticsVo:
:
getName
).
distinct
().
sorted
(
Comparator
.
comparing
(
String:
:
toString
)).
collect
(
Collectors
.
toList
()));
//形态
List
<
Integer
>
types
=
deviceStatisticsVoList
.
stream
().
map
(
DeviceStatisticsVo:
:
getType
).
distinct
().
collect
(
Collectors
.
toList
());
Collections
.
sort
(
types
);
map
.
put
(
"types"
,
types
.
stream
().
map
(
integer
->
new
TypeVo
(
integer
,
styleMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
return
ResultUtil
.
success
(
map
);
}
// @ApiOperation(value = "本级模糊查询核心装备统计分页", notes = "可以通过这个接口查询装备列表")
// @PostMapping("/core/stat/local/summary")
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
52a09525
...
...
@@ -51,6 +51,15 @@ public interface DeviceLibraryService {
* @param pageable 获取装备统计分页
*/
List
<
DeviceStatisticsVo
>
getDeviceStatisticsPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
,
Sort
sort
);
/**
* 后续修改为可以勾选多个单位
* @param deviceLibrarySelectVo
* @param pageable
* @param sort
* @return
*/
List
<
DeviceStatisticsVo
>
getDeviceStatisticsPage1
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
,
Sort
sort
);
// /**
// * @param deviceLibrarySelectVo 装备查询vo
// * @param pageable 获取装备统计分页
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
52a09525
...
...
@@ -140,6 +140,26 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return
deviceLibraryDao
.
findAll
(
predicateBuilder
.
build
());
}
private
List
<
DeviceLibrary
>
getCoreDevicePageForUnitIds
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
List
<
Integer
>
unitIdList
=
deviceLibrarySelectVo
.
getUnitIdList
();
List
<
String
>
unitNameList
=
new
ArrayList
<>();
if
(
unitIdList
.
size
()
>
0
){
unitIdList
.
forEach
(
integer
->
{
Units
cache
=
unitsCache
.
findById
(
integer
);
unitNameList
.
add
(
cache
.
getName
());
});
}
PredicateBuilder
<
DeviceLibrary
>
predicateBuilder
=
Specifications
.
and
();
if
(
deviceLibrarySelectVo
.
getUnitIdList
()
!=
null
){
predicateBuilder
.
in
(
"ownUnit"
,
unitNameList
.
toArray
());
}
//型号 名称
predicateBuilder
.
eq
(
deviceLibrarySelectVo
.
getModel
()
!=
null
,
"model"
,
deviceLibrarySelectVo
.
getModel
());
predicateBuilder
.
eq
(
deviceLibrarySelectVo
.
getName
()
!=
null
,
"name"
,
deviceLibrarySelectVo
.
getName
());
return
deviceLibraryDao
.
findAll
(
predicateBuilder
.
build
());
}
@Override
public
List
<
DeviceLibrary
>
getCoreDevicePage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
Integer
selectUnitId
=
deviceLibrarySelectVo
.
getUnitId
();
...
...
@@ -251,6 +271,176 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
// BeanUtils.copyProperties(deviceLibrarySelectVo, d);
d
.
setSize
(
Integer
.
MAX_VALUE
);
d
.
setPage
(
0
);
// d.setAreaId(deviceLibrarySelectVo.getAreaId());
// d.setUnitId(deviceLibrarySelectVo.getUnitId());
d
.
setModel
(
deviceLibrarySelectVo
.
getModel
());
d
.
setName
(
deviceLibrarySelectVo
.
getName
());
d
.
setContent
(
deviceLibrarySelectVo
.
getContent
());
d
.
setType
(
deviceLibrarySelectVo
.
getType
());
d
.
setStorageLocationId
(
deviceLibrarySelectVo
.
getStorageLocationId
());
//获取所有的核心装备
List
<
DeviceLibrary
>
libraryEntities
=
getCoreDevicePage
(
d
);
if
(
libraryEntities
.
size
()
>
0
)
{
// Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
libraryEntities
.
stream
().
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()+
"Ǵ"
+
deviceLibrary
.
getName
()+
"Ǵ"
+
deviceLibrary
.
getType
()+
"Ǵ"
+
deviceLibrary
.
getMatchingRangeName
()+
"Ǵ"
+
deviceLibrary
.
getIsPart
()));
//按型号遍历统计各种状态的装备数量
for
(
String
s
:
map
.
keySet
())
{
String
[]
strings
=
s
.
split
(
"Ǵ"
);
if
(
strings
.
length
==
5
)
{
DeviceStatisticsVo
deviceStatisticsVo
=
new
DeviceStatisticsVo
();
List
<
Integer
>
deviceIds
=
new
ArrayList
<>();
List
<
String
>
devSeqs
=
new
ArrayList
<>();
deviceStatisticsVo
.
setModel
(
strings
[
0
]);
deviceStatisticsVo
.
setName
(
strings
[
1
]);
deviceStatisticsVo
.
setType
(
Integer
.
valueOf
(
strings
[
2
]));
deviceStatisticsVo
.
setMatchingRangeName
(
strings
[
3
]);
deviceStatisticsVo
.
setIsPart
(
Integer
.
valueOf
(
strings
[
4
]));
// deviceStatisticsVo.setDeviceNumber(map.get(s).size());
// deviceStatisticsVo.setDeviceIds(map.get(s).stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
int
num
=
0
;
int
inLibraryNum
=
0
;
int
repairNum
=
0
;
int
destoryNum
=
0
;
int
scrappedNum
=
0
;
int
allotNum
=
0
;
int
retiredNum
=
0
;
int
useNum
=
0
;
List
<
Integer
>
inLibraryIds
=
new
ArrayList
<>();
List
<
Integer
>
repairIds
=
new
ArrayList
<>();
List
<
Integer
>
destoryIds
=
new
ArrayList
<>();
List
<
Integer
>
retiredIds
=
new
ArrayList
<>();
List
<
Integer
>
scrappedIds
=
new
ArrayList
<>();
List
<
Integer
>
allotIds
=
new
ArrayList
<>();
List
<
Integer
>
useIds
=
new
ArrayList
<>();
//遍历核心装备,按照相同型号的装备生命状态统计
for
(
DeviceLibrary
d2
:
map
.
get
(
s
))
{
deviceIds
.
add
(
d2
.
getId
());
if
(
d2
.
getSeqNumber
()!=
null
)
{
devSeqs
.
add
(
d2
.
getSeqNumber
());
}
num
++;
switch
(
d2
.
getLifeStatus
())
{
case
2
:
inLibraryNum
++;
inLibraryIds
.
add
(
d2
.
getId
());
break
;
case
3
:
allotNum
++;
allotIds
.
add
(
d2
.
getId
());
break
;
case
4
:
//如果所属跟所在不一致
if
(!
d2
.
getLocationUnit
().
equals
(
d2
.
getOwnUnit
())){
if
(
d2
.
getOwnUnit
().
equals
(
userUtils
.
getCurrentUserUnitName
())){
repairNum
++;
repairIds
.
add
(
d2
.
getId
());
}
}
else
{
repairNum
++;
repairIds
.
add
(
d2
.
getId
());
}
break
;
case
5
:
scrappedNum
++;
scrappedIds
.
add
(
d2
.
getId
());
break
;
case
17
:
scrappedNum
++;
scrappedIds
.
add
(
d2
.
getId
());
break
;
case
18
:
scrappedNum
++;
scrappedIds
.
add
(
d2
.
getId
());
break
;
case
6
:
retiredNum
++;
retiredIds
.
add
(
d2
.
getId
());
break
;
case
7
:
retiredNum
++;
retiredIds
.
add
(
d2
.
getId
());
break
;
case
9
:
destoryNum
++;
allotIds
.
add
(
d2
.
getId
());
break
;
case
10
:
destoryNum
++;
destoryIds
.
add
(
d2
.
getId
());
break
;
case
19
:
destoryNum
++;
destoryIds
.
add
(
d2
.
getId
());
break
;
case
20
:
destoryNum
++;
destoryIds
.
add
(
d2
.
getId
());
break
;
case
13
:
scrappedNum
++;
scrappedIds
.
add
(
d2
.
getId
());
break
;
case
14
:
useNum
++;
useIds
.
add
(
d2
.
getId
());
break
;
default
:
break
;
}
}
//添加统计vo
if
(
num
>
0
)
{
deviceStatisticsVo
.
setDeviceIds
(
deviceIds
);
deviceStatisticsVo
.
setAllotIds
(
allotIds
);
deviceStatisticsVo
.
setDestoryIds
(
destoryIds
);
deviceStatisticsVo
.
setInLibraryIds
(
inLibraryIds
);
deviceStatisticsVo
.
setRepairIds
(
repairIds
);
deviceStatisticsVo
.
setRetiredIds
(
retiredIds
);
deviceStatisticsVo
.
setScrappedIds
(
scrappedIds
);
deviceStatisticsVo
.
setUseIds
(
useIds
);
deviceStatisticsVo
.
setDeviceNumber
(
num
);
deviceStatisticsVo
.
setAllotNum
(
allotNum
);
deviceStatisticsVo
.
setInLibraryNum
(
inLibraryNum
);
deviceStatisticsVo
.
setRepairNum
(
repairNum
);
deviceStatisticsVo
.
setDestoryNum
(
destoryNum
);
deviceStatisticsVo
.
setScrappedNum
(
scrappedNum
);
deviceStatisticsVo
.
setRetiredNum
(
retiredNum
);
deviceStatisticsVo
.
setUseNum
(
useNum
);
deviceStatisticsVo
.
setOtherNum
(
num
-
allotNum
-
inLibraryNum
-
repairNum
-
destoryNum
-
scrappedNum
-
retiredNum
-
useNum
);
deviceIds
.
removeAll
(
allotIds
);
deviceIds
.
removeAll
(
destoryIds
);
deviceIds
.
removeAll
(
inLibraryIds
);
deviceIds
.
removeAll
(
repairIds
);
deviceIds
.
removeAll
(
retiredIds
);
deviceIds
.
removeAll
(
scrappedIds
);
deviceIds
.
removeAll
(
useIds
);
deviceStatisticsVo
.
setOtherNumIds
(
deviceIds
);
deviceStatisticsVo
.
setSeqs
(
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
devSeqs
)));
deviceStatisticsVos
.
add
(
deviceStatisticsVo
);
}
}
}
if
(
deviceLibrarySelectVo
.
getName
()
!=
null
)
{
deviceStatisticsVos
=
selectByName
(
deviceLibrarySelectVo
.
getName
(),
deviceStatisticsVos
);
}
return
deviceStatisticsVos
;
}
return
deviceStatisticsVos
;
}
@Override
public
List
<
DeviceStatisticsVo
>
getDeviceStatisticsPage1
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
,
Sort
sort
)
{
List
<
DeviceStatisticsVo
>
deviceStatisticsVos
=
new
ArrayList
<>();
DeviceLibrarySelectVo
d
=
new
DeviceLibrarySelectVo
();
d
.
setSize
(
Integer
.
MAX_VALUE
);
d
.
setPage
(
0
);
d
.
setAreaId
(
deviceLibrarySelectVo
.
getAreaId
());
d
.
setUnitId
(
deviceLibrarySelectVo
.
getUnitId
());
d
.
setModel
(
deviceLibrarySelectVo
.
getModel
());
...
...
@@ -258,8 +448,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
d
.
setContent
(
deviceLibrarySelectVo
.
getContent
());
d
.
setType
(
deviceLibrarySelectVo
.
getType
());
d
.
setStorageLocationId
(
deviceLibrarySelectVo
.
getStorageLocationId
());
d
.
setUnitIdList
(
deviceLibrarySelectVo
.
getUnitIdList
());
//获取所有的核心装备
List
<
DeviceLibrary
>
libraryEntities
=
getCoreDevicePage
(
d
);
List
<
DeviceLibrary
>
libraryEntities
=
getCoreDevicePage
ForUnitIds
(
d
);
if
(
libraryEntities
.
size
()
>
0
)
{
// Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
libraryEntities
.
stream
().
collect
(
groupingBy
(
deviceLibrary
->
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceLibrarySelectVo.java
浏览文件 @
52a09525
...
...
@@ -146,4 +146,7 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty
(
value
=
"装备序列号"
,
example
=
"123-1"
)
public
String
seqNumber
;
@ApiModelProperty
(
value
=
"单位id的集合"
)
private
List
<
Integer
>
unitIdList
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论