Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
75e40174
提交
75e40174
authored
4月 26, 2021
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新
上级
48b0757a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
71 行增加
和
20 行删除
+71
-20
DeviceApplyController.java
...kj/dev/device/apply/controller/DeviceApplyController.java
+50
-3
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+21
-17
没有找到文件。
dev-apply/src/main/java/com/tykj/dev/device/apply/controller/DeviceApplyController.java
浏览文件 @
75e40174
...
@@ -15,6 +15,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
...
@@ -15,6 +15,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.library.subject.vo.Script
;
import
com.tykj.dev.device.packing.controller.PackingController
;
import
com.tykj.dev.device.packing.controller.PackingController
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.packing.subject.domin.PackingLibrary
;
import
com.tykj.dev.device.packing.subject.domin.PackingLibrary
;
...
@@ -50,6 +51,8 @@ import org.springframework.web.bind.annotation.*;
...
@@ -50,6 +51,8 @@ import org.springframework.web.bind.annotation.*;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
groupingBy
;
/**
/**
* @author dengdiyi
* @author dengdiyi
*/
*/
...
@@ -488,26 +491,70 @@ public class DeviceApplyController {
...
@@ -488,26 +491,70 @@ public class DeviceApplyController {
Set
<
Integer
>
lifeStatus
=
deviceLibraries
.
stream
().
map
(
DeviceLibrary:
:
getLifeStatus
).
collect
(
Collectors
.
toSet
());
Set
<
Integer
>
lifeStatus
=
deviceLibraries
.
stream
().
map
(
DeviceLibrary:
:
getLifeStatus
).
collect
(
Collectors
.
toSet
());
Set
<
Integer
>
integers
=
new
HashSet
<>();
Set
<
Integer
>
integers
=
new
HashSet
<>();
integers
.
add
(
11
);
integers
.
add
(
11
);
final
Integer
status
;
if
(
deviceApplyBill
.
getApplyType
()==
2
)
{
if
(
deviceApplyBill
.
getApplyType
()==
2
)
{
integers
.
add
(
15
);
integers
.
add
(
15
);
integers
.
add
(
12
);
integers
.
add
(
12
);
integers
.
add
(
16
);
integers
.
add
(
16
);
status
=
15
;
}
}
if
(
deviceApplyBill
.
getApplyType
()==
3
){
else
if
(
deviceApplyBill
.
getApplyType
()==
3
){
integers
.
add
(
17
);
integers
.
add
(
17
);
integers
.
add
(
5
);
integers
.
add
(
5
);
integers
.
add
(
18
);
integers
.
add
(
18
);
status
=
17
;
}
}
if
(
deviceApplyBill
.
getApplyType
()==
4
){
else
if
(
deviceApplyBill
.
getApplyType
()==
4
){
integers
.
add
(
19
);
integers
.
add
(
19
);
integers
.
add
(
10
);
integers
.
add
(
10
);
integers
.
add
(
20
);
integers
.
add
(
20
);
status
=
19
;
}
else
{
throw
new
ApiException
(
"申请类型只能为2,3,4"
);
}
}
if
(
integers
.
containsAll
(
lifeStatus
)){
if
(
integers
.
containsAll
(
lifeStatus
)){
return
ResponseEntity
.
ok
(
true
);
List
<
Script
>
scripts
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
deviceLibraryList1
=
deviceLibraries
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getLifeStatus
().
equals
(
status
)).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
List
<
DeviceLibrary
>>
map
=
deviceLibraryList1
.
stream
().
collect
(
groupingBy
(
DeviceLibrary:
:
getPackingId
));
for
(
Integer
packingId:
map
.
keySet
()){
List
<
DeviceLibrary
>
deviceLibraryList
=
map
.
get
(
packingId
);
PackingLibrary
packingLibrary
=
packingLibraryService
.
getOne
(
packingId
);
Script
script
=
new
Script
();
script
.
setId
(
packingId
);
script
.
setPartParentId
(
packingLibrary
.
getPartParentId
());
script
.
setInvisibleRange
(
packingLibrary
.
getInvisibleRangeName
());
script
.
setModel
(
packingLibrary
.
getModel
());
script
.
setName
(
packingLibrary
.
getName
());
script
.
setSecretLevel
(
packingLibrary
.
getSecretLevelName
());
script
.
setType
(
packingLibrary
.
getTypeName
());
script
.
setNum
(
deviceLibraryList
.
size
());
script
.
setSeqNumber
(
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
deviceLibraryList
.
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
()))));
scripts
.
add
(
script
);
}
Map
<
Integer
,
Script
>
nodeCollect
=
scripts
.
stream
().
collect
(
Collectors
.
toMap
(
Script:
:
getId
,
script
->
script
));
List
<
Script
>
scriptList
=
new
ArrayList
<>();
List
<
Script
>
conList
=
GetTreeUtils
.
parseTreeFromDown
(
scripts
,
Script:
:
getId
,
script
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
script
.
getPartParentId
())),
Script:
:
addChildNode
);
for
(
Script
s:
conList
)
{
addScript
(
scriptList
,
s
);
}
return
ResponseEntity
.
ok
(
scriptList
);
}
}
else
{
else
{
return
ResponseEntity
.
ok
(
false
);
return
ResponseEntity
.
ok
(
false
);
}
}
}
}
private
void
addScript
(
List
<
Script
>
scripts
,
Script
script
){
scripts
.
add
(
script
);
if
(
script
.
getChilds
()!=
null
&&
script
.
getChilds
().
size
()>
0
){
script
.
getChilds
().
forEach
(
s
->
addScript
(
scripts
,
s
));
}
}
}
}
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
浏览文件 @
75e40174
...
@@ -194,6 +194,7 @@ public class DeviceLibraryController {
...
@@ -194,6 +194,7 @@ public class DeviceLibraryController {
Set
<
String
>
ownUnits
=
new
HashSet
<>();
Set
<
String
>
ownUnits
=
new
HashSet
<>();
Set
<
String
>
locationUnits
=
new
HashSet
<>();
Set
<
String
>
locationUnits
=
new
HashSet
<>();
resultList
.
forEach
(
deviceVo
->
{
resultList
.
forEach
(
deviceVo
->
{
deviceVo
.
setConfigName
();
status
.
add
(
deviceVo
.
getLifeStatus
());
status
.
add
(
deviceVo
.
getLifeStatus
());
models
.
add
(
deviceVo
.
getModel
());
models
.
add
(
deviceVo
.
getModel
());
names
.
add
(
deviceVo
.
getName
());
names
.
add
(
deviceVo
.
getName
());
...
@@ -264,29 +265,32 @@ public class DeviceLibraryController {
...
@@ -264,29 +265,32 @@ public class DeviceLibraryController {
// }
// }
// }
// }
// }
// }
List
<
Device
Vo
>
containList
=
GetTreeUtils
.
parseTreeFromDown
(
List
<
Device
Library
>
containList
=
GetTreeUtils
.
parseTreeFromDown
(
resultList
,
resultList
,
DeviceLibrary:
:
getId
,
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
DeviceLibrary:
:
addChildNode
DeviceLibrary:
:
addChildNode
).
stream
().
map
(
DeviceLibrary:
:
parseVo
).
collect
(
Collectors
.
toList
());
);
// if (comparators.size()==1){
// containList = containList.stream().sorted(comparators.get(0)).collect(Collectors.toList());
// }
// else if(comparators.size()==2){
// containList = containList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1))).collect(Collectors.toList());
// }
// else if(comparators.size()==3){
// containList = containList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1)).thenComparing(comparators.get(2))).collect(Collectors.toList());
// }
map
.
put
(
"models"
,
resultList
.
stream
().
map
(
DeviceLibrary:
:
getModel
).
collect
(
Collectors
.
toSet
()));
map
.
put
(
"names"
,
resultList
.
stream
().
map
(
DeviceLibrary:
:
getName
).
collect
(
Collectors
.
toSet
()));
map
.
put
(
"ownUnits"
,
resultList
.
stream
().
map
(
DeviceLibrary:
:
getOwnUnit
).
collect
(
Collectors
.
toSet
()));
map
.
put
(
"locationUnits"
,
resultList
.
stream
().
map
(
DeviceLibrary:
:
getLocationUnit
).
collect
(
Collectors
.
toSet
()));
Set
<
Integer
>
status
=
resultList
.
stream
().
map
(
DeviceLibrary:
:
getLifeStatus
).
collect
(
Collectors
.
toSet
());
Map
<
Integer
,
String
>
lifeStatusMap
=
configCache
.
getLifeStatusMap
();
Map
<
Integer
,
String
>
lifeStatusMap
=
configCache
.
getLifeStatusMap
();
Set
<
Integer
>
status
=
new
HashSet
<>();
Set
<
String
>
models
=
new
HashSet
<>();
Set
<
String
>
names
=
new
HashSet
<>();
Set
<
String
>
ownUnits
=
new
HashSet
<>();
Set
<
String
>
locationUnits
=
new
HashSet
<>();
resultList
.
forEach
(
deviceVo
->
{
deviceVo
.
setConfigName
();
status
.
add
(
deviceVo
.
getLifeStatus
());
models
.
add
(
deviceVo
.
getModel
());
names
.
add
(
deviceVo
.
getName
());
ownUnits
.
add
(
deviceVo
.
getOwnUnit
());
locationUnits
.
add
(
deviceVo
.
getLocationUnit
());
});
map
.
put
(
"models"
,
models
);
map
.
put
(
"names"
,
names
);
map
.
put
(
"ownUnits"
,
ownUnits
);
map
.
put
(
"locationUnits"
,
locationUnits
);
map
.
put
(
"lifeStatus"
,
status
.
stream
().
map
(
integer
->
new
LifeStatusVo
(
integer
,
lifeStatusMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
map
.
put
(
"lifeStatus"
,
status
.
stream
().
map
(
integer
->
new
LifeStatusVo
(
integer
,
lifeStatusMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
Page
<
Device
Vo
>
deviceLibraryEntities
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
containList
,
deviceLibrarySelectVo
.
getPageable
());
Page
<
Device
Library
>
deviceLibraryEntities
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
containList
,
deviceLibrarySelectVo
.
getPageable
());
map
.
put
(
"pages"
,
deviceLibraryEntities
);
map
.
put
(
"pages"
,
deviceLibraryEntities
);
return
ResultUtil
.
success
(
map
);
return
ResultUtil
.
success
(
map
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论