Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
63aaf335
提交
63aaf335
authored
9月 29, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(核查模块): 修正了自动办结,审阅的相关机制
- 省退回之后,新的任务显示应该是`无` 而不是`未通过` - 省本级的任务完成之后,自动触发省审核通过 - 省审核通过之后,检验整个节点树是否所有节点都是审核通过,如果是,则自动完结任务。
上级
b51a26ec
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
259 行增加
和
137 行删除
+259
-137
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+83
-12
DeviceCheckDetail.java
.../device/confirmcheck/entity/domain/DeviceCheckDetail.java
+30
-24
ConfirmCheckServiceImpl.java
...ce/confirmcheck/service/impl/ConfirmCheckServiceImpl.java
+1
-1
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+5
-4
TaskService.java
...in/java/com/tykj/dev/device/task/service/TaskService.java
+7
-0
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+21
-0
UnitsService.java
...om/tykj/dev/device/user/subject/service/UnitsService.java
+2
-0
UnitsServiceImpl.java
...ev/device/user/subject/service/impl/UnitsServiceImpl.java
+110
-96
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
63aaf335
...
...
@@ -44,6 +44,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.bto.AreaUnit
;
import
com.tykj.dev.device.user.subject.service.AuService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UserService
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.misc.base.ResultObj
;
...
...
@@ -134,6 +135,8 @@ public class DeviceCheckController {
private
MessageService
messageService
;
@Autowired
private
TaskLogService
taskLogService
;
@Autowired
private
UnitsService
unitsService
;
@GetMapping
(
"/area/{fatherId}"
)
@ApiOperation
(
value
=
"查询指定区域下的所有区域信息"
)
...
...
@@ -548,19 +551,21 @@ public class DeviceCheckController {
finalTime
=
System
.
currentTimeMillis
();
log
.
info
(
"[TEST] COST {} MS"
,
finalTime
-
startTime
);
}
// check type = 1 检查页面 看见的是自查
// check type = 1 检查页面 看见的是自查
1=省核查,2=省检查,3=3级结构下的市检查,4=2级结构下的市检查
if
(
ctVo
.
getCheckType
()
==
1
)
{
Integer
createUserId
=
ctVo
.
getCreateUserId
();
if
(
userIsProv
(
createUserId
))
{
Integer
ownUnit
=
rootTask
.
getOwnUnit
();
if
(
unitsService
.
isProvUnit
(
ownUnit
))
{
linkVo
.
setType
(
2
);
}
else
{
}
else
if
(
rootTask
.
getParentTaskId
()
!=
0
)
{
linkVo
.
setType
(
3
);
}
else
{
linkVo
.
setType
(
4
);
}
// 找到所有的子节点
List
<
Task
>
childTask
=
taskRepo
.
findAllByParentTaskId
(
rootTask
.
getId
());
//核查组成员和名称 找到父亲级节点 然后找到父节点的统计节点
String
[]
checkArray
=
ctVo
.
getRemark
().
split
(
"\\|"
);
// x,a |x ,b
List
<
String
>
groupNames
=
new
ArrayList
<>();
...
...
@@ -1214,8 +1219,13 @@ public class DeviceCheckController {
log
.
info
(
"[核查模块] 详情任务推进到下个阶段..."
);
taskService
.
moveToNext
(
currentTask
);
summaryDetail
(
currentTask
,
currentDetail
);
// // 检查该exam任务是否可以完结推进了
advanceExamTask
(
currentTask
.
getParentTaskId
());
// 检查该exam任务是否可以完结推进了
advanceExamTask
(
currentTask
.
getParentTaskId
(),
true
);
// 如果是省本级的自查任务,则自动触发省审核通过
if
(
unitsService
.
isProvUnit
(
currentTask
.
getOwnUnit
()))
{
provAudit
(
currentDetail
.
getId
(),
true
);
}
}
}
else
{
//不通过则回到第一阶段
...
...
@@ -1257,7 +1267,7 @@ public class DeviceCheckController {
currentDetail
=
detailRepo
.
save
(
currentDetail
);
summaryDetail
(
currentTask
,
currentDetail
);
// // 检查该exam任务是否可以完结推进了
advanceExamTask
(
currentTask
.
getParentTaskId
());
advanceExamTask
(
currentTask
.
getParentTaskId
()
,
false
);
return
ResponseEntity
.
ok
(
"市专管员审核通过,结束"
+
currentDetail
.
getCheckUnit
()
+
" 区的自查任务并汇总数据"
);
}
else
{
...
...
@@ -1625,7 +1635,7 @@ public class DeviceCheckController {
String
remark
=
task
.
getRemark
();
if
(
situation
.
equals
(
"无"
))
{
if
(
Objects
.
nonNull
(
remark
)
&&
remark
.
contains
(
"ROLLBACK"
))
{
situation
=
"
未通过
"
;
situation
=
"
无
"
;
}
}
...
...
@@ -1735,9 +1745,16 @@ public class DeviceCheckController {
*
* @param exam的taskId
*/
private
void
advanceExamTask
(
Integer
examTaskId
)
{
private
void
advanceExamTask
(
Integer
examTaskId
,
boolean
exec
)
{
TaskBto
parentTask
=
taskService
.
findByTaskId
(
examTaskId
);
if
(
parentTask
.
getBillStatus
().
equals
(
CHECK_EXAM_STAT_1
.
id
)
&&
parentTask
.
getParentTaskId
()
!=
0
&&
taskService
.
TaskTreeIsOver
(
examTaskId
))
{
if
(
exec
)
{
exec
=
parentTask
.
getParentTaskId
()
!=
0
;
}
else
{
exec
=
true
;
}
// && parentTask.getParentTaskId() != 0
if
(
parentTask
.
getBillStatus
().
equals
(
CHECK_EXAM_STAT_1
.
id
)
&&
exec
&&
taskService
.
TaskTreeIsOver
(
examTaskId
))
{
log
.
info
(
"[核查模块] 检测到task id = {}的检查任务已经可以自动推进了,自动推进至下一步"
,
examTaskId
);
statConfirm
(
parentTask
.
getBillId
());
}
...
...
@@ -1779,13 +1796,14 @@ public class DeviceCheckController {
// 添加阅知信息
List
<
Integer
>
involveUserIds
=
node
.
parse2Bto
().
getInvolveUserIdList
();
int
lastUserId
=
involveUserIds
.
get
(
involveUserIds
.
size
()
-
1
)
==
null
?
0
:
involveUserIds
.
get
(
involveUserIds
.
size
()
-
1
);
List
<
Integer
>
msgUserIds
;
List
<
Integer
>
msgUserIds
=
new
ArrayList
<>()
;
if
(
lastUserId
==
0
)
{
msgUserIds
=
userService
.
findByUniteId
(
node
.
getOwnUnit
()).
stream
()
.
map
(
UserShenRe:
:
getUserId
)
.
collect
(
toList
());
}
else
{
msgUserIds
=
new
ArrayList
<>(
lastUserId
);
msgUserIds
=
new
ArrayList
<>();
msgUserIds
.
add
(
lastUserId
);
}
MessageBto
msgBto
=
new
MessageBto
(
node
.
getId
(),
node
.
getBusinessType
(),
shutDownMsg
,
msgUserIds
);
messageService
.
add
(
msgBto
);
...
...
@@ -1845,6 +1863,7 @@ public class DeviceCheckController {
cDetail
.
setCheckDetail
(
initalDetail
);
cDetail
.
setCheckFiles
(
""
);
cDetail
.
setCheckFileList
(
Lists
.
newArrayList
());
cDetail
.
setReview
(
false
);
cDetail
=
detailRepo
.
save
(
cDetail
);
// 创建新的任务(被拒绝的自查单位如果是区则是140状态,否则是160状态 )
String
unitName
=
cDetail
.
getCheckUnit
();
...
...
@@ -1893,6 +1912,14 @@ public class DeviceCheckController {
//4.父级任务变为进行中 如果父级是核查,变成111,如果父级是检查,变成131
if
(
fatherTask
.
getCustomInfo
().
contains
(
"exam"
))
{
fatherTask
.
setBillStatus
(
CHECK_EXAM_STAT_1
.
id
);
// 父级的父级也要设置 exam的父级是check
if
(
fatherTask
.
getParentTaskId
()
!=
0
)
{
Task
checkTask
=
taskRepo
.
findById
(
fatherTask
.
getParentTaskId
())
.
orElseThrow
(()
->
new
ApiException
(
String
.
format
(
"没有找到核查任务,子Task id %d"
,
fatherTask
.
getId
())));
log
.
info
(
"[核查模块] 回滚核查任务 taskId = {}"
,
checkTask
.
getId
());
checkTask
.
setBillStatus
(
CHECK_STAT_1
.
id
);
taskRepo
.
save
(
checkTask
);
}
}
else
if
(
fatherTask
.
getCustomInfo
().
contains
(
"check"
))
{
fatherTask
.
setBillStatus
(
CHECK_STAT_1
.
id
);
}
...
...
@@ -1914,6 +1941,7 @@ public class DeviceCheckController {
String
updatedString
=
changeHunds
(
detail
.
getCheckDetail
(),
2
);
detail
.
setCheckDetail
(
updatedString
);
detail
.
setUserCId
(
authenticationUtils
.
getAuthentication
().
getCurrentUserInfo
().
getUserId
());
detail
.
setReview
(
true
);
log
.
info
(
"[核查模块] 审核通过 - 更新后的detailString形如 {}"
,
updatedString
.
split
(
","
)[
0
]);
detailRepo
.
save
(
detail
);
...
...
@@ -1931,10 +1959,53 @@ public class DeviceCheckController {
}
}
}
// 检验整个节点树是否所有节点都是审核通过,如果是,则自动完结任务
TaskBto
topNode
=
taskService
.
getTopNode
(
currentTask
.
getId
());
if
(
allDetailIsReview
(
topNode
))
{
log
.
info
(
"[核查模块] 该节点树的时候自查节点都已经完结,完结整个节点树,触发的子节点id = {},顶节点id = {}"
,
currentTask
.
getId
(),
topNode
.
getId
());
shutDown
(
topNode
.
getBillId
());
}
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"审核通过!"
));
}
/**
* 查询该节点所在的节点树的所有detail是否都已经被查阅
*
* @param topTask
* @return
*/
private
boolean
allDetailIsReview
(
TaskBto
topTask
)
{
// 获取顶节点
List
<
Task
>
c1Tasks
=
taskRepo
.
findAllByParentTaskId
(
topTask
.
getId
());
// 获取detailList 根据detailList的checkUnit分组,取id最大的一条,每个组里必须为true才能触发
List
<
Integer
>
detailIdList
=
new
ArrayList
<>();
// 所有的检查任务是否都完结了
boolean
examIsDone
=
true
;
boolean
detailIsDone
=
true
;
for
(
Task
c1
:
c1Tasks
)
{
if
(
c1
.
getCustomInfo
().
equals
(
"manual"
))
{
detailIdList
.
add
(
c1
.
getBillId
());
}
if
(
c1
.
getCustomInfo
().
equals
(
"exam"
))
{
if
(!(
c1
.
getBillStatus
().
equals
(
END
.
id
)
||
c1
.
getBillStatus
().
equals
(
CHECK_SHUT_DOWN
.
id
)))
{
examIsDone
=
false
;
}
Collection
<
Integer
>
regionDetailIds
=
taskRepo
.
findAllByParentTaskId
(
c1
.
getId
()).
stream
()
.
filter
(
t
->
t
.
getCustomInfo
().
equals
(
"manual"
))
.
collect
(
groupingBy
(
Task:
:
getOwnUnit
,
collectingAndThen
(
maxBy
(
Comparator
.
comparing
(
Task:
:
getId
)),
task
->
task
.
get
().
getBillId
())))
.
values
();
detailIdList
.
addAll
(
regionDetailIds
);
}
}
detailIsDone
=
detailRepo
.
findAllById
(
detailIdList
).
stream
()
.
allMatch
(
DeviceCheckDetail:
:
isReview
);
return
detailIsDone
&&
examIsDone
;
}
private
void
removeDetailFromDcs
(
DeviceCheckDetail
detail
,
DeviceCheckStat
dcs
)
{
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/domain/DeviceCheckDetail.java
浏览文件 @
63aaf335
...
...
@@ -131,6 +131,12 @@ public class DeviceCheckDetail extends BaseEntity {
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
/**
* true-已审阅,false-未审阅
*/
@ApiModelProperty
(
value
=
"省是否审阅"
)
private
boolean
review
=
false
;
/**
* 预留字段2 现在用来记录该自查任务的初始状态号
*/
...
...
@@ -199,29 +205,6 @@ public class DeviceCheckDetail extends BaseEntity {
this
.
remark
=
remark
;
}
public
void
updateDevice
(
List
<
DeviceLibrary
>
devInLib
,
List
<
DeviceLibrary
>
devNotInLib
){
//构造checkDetail 分当前在库与不在库的 赋予不同状态
String
goodCheckDetail
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
devInLib
))
{
goodCheckDetail
=
devInLib
.
stream
()
.
map
(
device
->
device
.
getId
()
+
"-9"
)
.
collect
(
Collectors
.
joining
(
","
));
}
String
badCheckDetail
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
devNotInLib
))
{
badCheckDetail
=
devNotInLib
.
stream
()
.
map
(
device
->
device
.
getId
()
+
"-3"
)
.
collect
(
Collectors
.
joining
(
","
));
}
//如果不在库的不为空,则拼接,否则没必要
String
checkDetail
=
StringUtils
.
isEmpty
(
badCheckDetail
)
?
goodCheckDetail
:
goodCheckDetail
+
","
+
badCheckDetail
;
this
.
checkDetail
=
checkDetail
;
}
/**
* @param checkUnit 要核查的单位
* @param devInLib 所属与所在均在本单位的装备集合
...
...
@@ -275,7 +258,30 @@ public class DeviceCheckDetail extends BaseEntity {
);
}
public
DeviceCheckDetail
copyWithoutId
(){
public
void
updateDevice
(
List
<
DeviceLibrary
>
devInLib
,
List
<
DeviceLibrary
>
devNotInLib
)
{
//构造checkDetail 分当前在库与不在库的 赋予不同状态
String
goodCheckDetail
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
devInLib
))
{
goodCheckDetail
=
devInLib
.
stream
()
.
map
(
device
->
device
.
getId
()
+
"-9"
)
.
collect
(
Collectors
.
joining
(
","
));
}
String
badCheckDetail
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
devNotInLib
))
{
badCheckDetail
=
devNotInLib
.
stream
()
.
map
(
device
->
device
.
getId
()
+
"-3"
)
.
collect
(
Collectors
.
joining
(
","
));
}
//如果不在库的不为空,则拼接,否则没必要
String
checkDetail
=
StringUtils
.
isEmpty
(
badCheckDetail
)
?
goodCheckDetail
:
goodCheckDetail
+
","
+
badCheckDetail
;
this
.
checkDetail
=
checkDetail
;
}
public
DeviceCheckDetail
copyWithoutId
()
{
ModelMapper
mapper
=
BeanHelper
.
getUserMapper
();
DeviceCheckDetail
detail
=
mapper
.
map
(
this
,
DeviceCheckDetail
.
class
);
this
.
setCreateTime
(
LocalDateTime
.
now
());
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/impl/ConfirmCheckServiceImpl.java
浏览文件 @
63aaf335
...
...
@@ -313,7 +313,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
List
<
TaskBto
>
topStatList
=
taskService
.
findBillType
(
7
);
List
<
Integer
>
topIdList
=
topStatList
.
stream
()
.
filter
(
taskBto
->
taskBto
.
getParentTaskId
().
equals
(
0
)
||
taskBto
.
getParentTaskId
()
==
null
)
.
filter
(
taskBto
->
taskBto
.
getParentTaskId
().
equals
(
0
)
||
taskBto
.
getParentTaskId
()
==
null
||
taskBto
.
getCustomInfo
().
equals
(
"exam"
)
)
.
map
(
TaskBto:
:
getBillId
)
.
collect
(
toList
());
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
63aaf335
...
...
@@ -43,8 +43,7 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
import
static
com
.
tykj
.
dev
.
misc
.
base
.
StatusEnum
.*;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
java
.
util
.
stream
.
Collectors
.
toMap
;
import
static
java
.
util
.
stream
.
Collectors
.*;
/**
* ObjTransUtil.
...
...
@@ -146,10 +145,12 @@ public class ObjTransUtil {
boolean
flag
=
false
;
// 3/3 -> 统计待确认 -> 省统计任务待完结
childTask
=
childTask
.
stream
()
.
filter
(
task
->
!
task
.
getTitle
().
contains
(
"统计数据待办任务"
))
.
filter
(
task
->
!
task
.
getTitle
().
contains
(
"统计数据确认任务"
))
.
collect
(
groupingBy
(
Task:
:
getOwnUnit
,
collectingAndThen
(
maxBy
(
Comparator
.
comparing
(
Task:
:
getId
)),
Optional:
:
get
)))
.
values
().
stream
()
.
collect
(
toList
());
long
total
=
childTask
.
size
();
...
...
@@ -192,7 +193,7 @@ public class ObjTransUtil {
checkUserNames
,
stat
.
getCreateTime
(),
completion
,
stat
.
getCheckType
().
CT_CHECK
.
getId
(),
stat
.
getCheckType
().
getId
(),
joiner
.
toString
()
);
...
...
dev-task/src/main/java/com/tykj/dev/device/task/service/TaskService.java
浏览文件 @
63aaf335
...
...
@@ -180,6 +180,13 @@ public interface TaskService {
*/
boolean
TaskTreeIsStart
(
int
rootId
,
boolean
currentIsOver
);
/**
* 获得该task树下的最顶部节点
* @param taskId 任务主键id
* @return 最顶部的节点
*/
TaskBto
getTopNode
(
Integer
taskId
);
/**
...
...
dev-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
63aaf335
...
...
@@ -1033,6 +1033,27 @@ public class TaskServiceImpl implements TaskService {
}
/**
* 获得该task树下的最顶部节点
*
* @param taskId 任务主键id
* @return 最顶部的节点
*/
@Override
public
TaskBto
getTopNode
(
Integer
taskId
)
{
Task
task
=
taskDao
.
findById
(
taskId
).
orElseThrow
(()
->
new
ApiException
(
String
.
format
(
"没有找到taskId = %d 的节点"
,
taskId
)));
Task
rootTask
=
task
;
while
(
true
){
if
(
rootTask
.
getParentTaskId
()
==
0
||
rootTask
.
getParentTaskId
()
==
null
)
{
break
;
}
else
{
rootTask
=
taskDao
.
findById
(
rootTask
.
getParentTaskId
()).
get
();
}
}
return
rootTask
.
parse2Bto
();
}
/**
* @param oldUserId 旧专管员id
* @param newUserId 新交接专管员id
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/UnitsService.java
浏览文件 @
63aaf335
...
...
@@ -178,4 +178,6 @@ public interface UnitsService extends PublicService<Units> {
Units
findNameUnit
(
UnitNameVo
unitNameVo
);
void
addUnitSortMap
();
boolean
isProvUnit
(
Integer
unitId
);
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UnitsServiceImpl.java
浏览文件 @
63aaf335
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
.
impl
;
import
com.tykj.dev.config.domin.SystemConfig
;
import
com.tykj.dev.config.service.SystemConfigService
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.ret.*
;
...
...
@@ -44,6 +43,7 @@ public class UnitsServiceImpl implements UnitsService {
@Autowired
SystemConfigService
systemConfigService
;
@Override
public
Units
findById
(
Integer
unitId
)
{
Optional
<
Units
>
unit
=
unitsDao
.
findById
(
unitId
);
...
...
@@ -74,17 +74,18 @@ public class UnitsServiceImpl implements UnitsService {
* 根据所在区域是省还是市
* 省 则把下属市以及市下属都区都单位统一放入市AreaVo 在放入List<AreaVo> 集合中。
* 市 则把下属区都单位放入市都AreaVo对象中
*
* @param thisArea 本单位区域
* @param areas 下级区域列表
*/
private
List
<
LeftNavigation
>
provinceAndCity
(
Area
thisArea
,
List
<
Area
>
areas
,
List
<
LeftNavigation
>
leftNavigationList
)
{
if
(
thisArea
.
getType
()
==
1
)
{
private
List
<
LeftNavigation
>
provinceAndCity
(
Area
thisArea
,
List
<
Area
>
areas
,
List
<
LeftNavigation
>
leftNavigationList
)
{
if
(
thisArea
.
getType
()
==
1
)
{
areas
.
forEach
(
area
->
{
LeftNavigation
leftNavigation
=
area
.
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
unitsDao
.
findAllByAreaId
(
area
.
getId
()).
forEach
(
units
->
{
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
leftNavigation1
.
setTheirId
(
units
.
getAreaId
());
leftNavigationList1
.
add
(
leftNavigation1
);
}
...
...
@@ -95,7 +96,7 @@ public class UnitsServiceImpl implements UnitsService {
countys
.
forEach
(
area1
->
unitsDao
.
findAllByAreaId
(
area1
.
getId
()).
forEach
(
units
->
{
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
leftNavigation1
.
setTheirId
(
area
.
getId
());
leftNavigationList1
.
add
(
leftNavigation1
);
}
...
...
@@ -103,21 +104,21 @@ public class UnitsServiceImpl implements UnitsService {
)
);
}
leftNavigation
.
setLeftNavigations
(
leftNavigationList1
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigation
.
setLeftNavigations
(
leftNavigationList1
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigationList
.
add
(
leftNavigation
);
});
}
else
if
(
thisArea
.
getType
()==
2
)
{
}
else
if
(
thisArea
.
getType
()
==
2
)
{
areas
.
forEach
(
area
->
{
unitsDao
.
findAllByAreaId
(
area
.
getId
()).
forEach
(
units
->
{
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
leftNavigation1
.
setTheirId
(
thisArea
.
getId
());
leftNavigationList
.
add
(
leftNavigation1
);
}
);
});
}
else
{
}
else
{
return
leftNavigationList
;
}
return
leftNavigationList
;
...
...
@@ -133,16 +134,16 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
Integer
>
findListSubordinateId
(
Integer
unitsId
)
{
Integer
areaId
=
unitsDao
.
findById
(
unitsId
).
get
().
getAreaId
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
return
unitsDao
.
findAllByAreaIdIn
(
areaIds
).
stream
().
map
(
Units:
:
getUnitId
).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
UnitsVo
>
findListVoSubordinateAreaId
(
Integer
areaId
)
{
List
<
UnitsVo
>
unitsVos
=
new
ArrayList
<>();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
UnitsVo
>
unitsVos
=
new
ArrayList
<>();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
areaIds
.
size
()
!=
0
)
{
unitsVos
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
).
stream
().
map
(
Units:
:
toVo
).
collect
(
Collectors
.
toList
());
unitsVos
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
).
stream
().
map
(
Units:
:
toVo
).
collect
(
Collectors
.
toList
());
}
return
unitsVos
;
}
...
...
@@ -155,13 +156,13 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
UnitsTrainVo
>
findListUnitsTrainVo
(
Integer
unitsId
)
{
Integer
areaId
=
unitsDao
.
findById
(
unitsId
).
get
().
getAreaId
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
return
unitsDao
.
findAllByAreaIdIn
(
areaIds
).
stream
().
map
(
Units:
:
toUnitsTrainVo
).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
Integer
>
findSuperiorByunitsId
(
Integer
unitsId
)
{
Area
area
=
areaDao
.
findById
(
this
.
findById
(
unitsId
).
getAreaId
()).
get
();
Area
area
=
areaDao
.
findById
(
this
.
findById
(
unitsId
).
getAreaId
()).
get
();
return
unitsDao
.
findAllByAreaId
(
area
.
getFatherId
()).
stream
().
map
(
Units:
:
getUnitId
).
collect
(
Collectors
.
toList
());
}
...
...
@@ -179,9 +180,9 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
Units
>
findBySubordinate
(
Integer
unitsId
)
{
Units
units
=
unitsDao
.
findById
(
unitsId
).
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
units1
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
if
(
units
.
getLevel
()==
1
)
{
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
units1
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
if
(
units
.
getLevel
()
==
1
)
{
units1
.
add
(
units
);
units1
.
addAll
(
unitsDao
.
findAllByType
(
2
));
}
...
...
@@ -203,9 +204,9 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
Units
>
findBySubordinateNotOneself
(
Integer
unitsId
)
{
Units
units
=
unitsDao
.
findById
(
unitsId
).
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
units1
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
if
(
units
.
getLevel
()
==
1
)
{
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
units1
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
if
(
units
.
getLevel
()
==
1
)
{
// units1.add(units);
units1
.
addAll
(
unitsDao
.
findAllByType
(
2
));
}
...
...
@@ -216,7 +217,7 @@ public class UnitsServiceImpl implements UnitsService {
public
List
<
String
>
findBySubordinateUnitName
(
Integer
unitsId
)
{
Units
units
=
unitsDao
.
findById
(
unitsId
).
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
units
.
getName
());
unitsDao
.
findAllByAreaIdIn
(
areaIds
).
forEach
(
units1
->
list
.
add
(
units1
.
getName
())
...
...
@@ -228,7 +229,7 @@ public class UnitsServiceImpl implements UnitsService {
public
List
<
Units
>
findBySubordinateUnit
(
Integer
unitsId
)
{
Units
units
=
unitsDao
.
findById
(
unitsId
).
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
list
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
List
<
Units
>
list
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
list
.
add
(
units
);
return
list
;
}
...
...
@@ -237,15 +238,13 @@ public class UnitsServiceImpl implements UnitsService {
public
UnitsPage
selectPage
(
Integer
page
,
Integer
size
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
,
Sort
.
Direction
.
ASC
,
"level"
);
Page
<
Units
>
unitsPage
=
unitsDao
.
findAll
(
pageable
);
List
<
Units
>
list
=
unitsPage
.
getContent
();
List
<
Units
>
list
=
unitsPage
.
getContent
();
list
.
forEach
(
units
->
{
if
(
units
.
getAreaId
()
>
0
)
{
if
(
units
.
getAreaId
()
>
0
)
{
units
.
setAreaName
(
areaDao
.
findById
(
units
.
getAreaId
()).
get
().
getName
());
}
else
if
(
units
.
getType
()==
2
){
}
else
if
(
units
.
getType
()
==
2
)
{
units
.
setAreaName
(
"浙江省"
);
}
else
{
}
else
{
units
.
setAreaName
(
"-"
);
}
});
...
...
@@ -260,12 +259,12 @@ public class UnitsServiceImpl implements UnitsService {
public
List
<
Units
>
findByUserIdUnitsTrainListVo
(
Integer
unitsId
)
{
Optional
<
Units
>
unitsOptional
=
unitsDao
.
findById
(
unitsId
);
if
(
unitsOptional
.
isPresent
())
{
Units
units
=
unitsOptional
.
get
();
Units
units
=
unitsOptional
.
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Units
>
unitsList
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
List
<
Units
>
unitsList
=
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
unitsList
.
add
(
units
);
return
unitsList
;
}
else
{
}
else
{
throw
new
ApiException
(
ResponseEntity
.
status
(
500
).
body
(
"单位没有查到"
));
}
}
...
...
@@ -282,30 +281,30 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
LeftNavigation
findLeftNavigation
(
SecurityUser
securityUser
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
||
belongsArea
.
getType
()==
2
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
||
belongsArea
.
getType
()
==
2
)
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
}
if
(
belongsArea
.
getType
()
==
1
)
{
if
(
belongsArea
.
getType
()
==
1
)
{
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
// leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省应急小组"
)&&
!
units1
.
getName
().
equals
(
"省机科技管理处"
)&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省应急小组"
)
&&
!
units1
.
getName
().
equals
(
"省机科技管理处"
)
&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()
==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
leftNavigationList
.
add
(
leftNavigation2
);
}
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
}
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
return
leftNavigation
;
}
...
...
@@ -313,40 +312,40 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
LeftNavigation
findLeftNavigation1
(
SecurityUser
securityUser
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
)
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
LeftNavigation
units
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
LeftNavigation
units
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
systemConfigService
.
getStorageLocationMap
().
forEach
(
(
k
,
v
)->
{
leftNavigationList1
.
add
(
new
LeftNavigation
(
0
,
v
,
null
,
v
,
3
,
k
,
units
.
getId
()));
(
k
,
v
)
->
{
leftNavigationList1
.
add
(
new
LeftNavigation
(
0
,
v
,
null
,
v
,
3
,
k
,
units
.
getId
()));
}
);
units
.
setLeftNavigations
(
leftNavigationList1
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
units
.
setLeftNavigations
(
leftNavigationList1
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigationList
.
add
(
units
);
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
// leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省应急小组"
)&&
!
units1
.
getName
().
equals
(
"省机科技管理处"
)&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省应急小组"
)
&&
!
units1
.
getName
().
equals
(
"省机科技管理处"
)
&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()
==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
leftNavigationList
.
add
(
leftNavigation2
);
}
if
(
belongsArea
.
getType
()==
2
)
{
if
(
belongsArea
.
getType
()
==
2
)
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
}
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
}
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
return
leftNavigation
;
}
...
...
@@ -354,50 +353,50 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
LeftNavigation
findLeftNavigation2
(
SecurityUser
securityUser
)
{
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省机科技管理处"
)&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省机科技管理处"
)
&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()
==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
return
leftNavigation2
;
}
@Override
public
LeftNavigation
findLeftNavigationNotDirectlyUnit
(
SecurityUser
securityUser
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
||
belongsArea
.
getType
()==
2
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
belongsArea
.
getType
()
==
1
||
belongsArea
.
getType
()
==
2
)
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
forEach
(
units
->
{
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
leftNavigation1
.
setTheirId
(
belongsArea
.
getId
());
leftNavigationList1
.
add
(
leftNavigation1
);
}
);
leftNavigationList
=
leftNavigationList1
;
leftNavigationList
=
leftNavigationList1
;
}
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
if
(
areas
.
size
()
!=
0
)
{
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
}
else
{
leftNavigation
=
belongsArea
.
toLeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList1
=
new
ArrayList
<>();
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
forEach
(
units
->
{
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
LeftNavigation
leftNavigation1
=
units
.
toLeftNavigation
();
leftNavigation1
.
setTheirId
(
belongsArea
.
getId
());
leftNavigationList1
.
add
(
leftNavigation1
);
}
);
leftNavigationList
=
leftNavigationList1
;
leftNavigationList
=
leftNavigationList1
;
}
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
return
leftNavigation
;
}
...
...
@@ -410,7 +409,7 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
Units
>
findDirectlyUnder
()
{
List
<
Units
>
unitsList
=
unitsDao
.
findAllByType
(
2
);
List
<
Units
>
unitsList
=
unitsDao
.
findAllByType
(
2
);
unitsList
.
addAll
(
unitsDao
.
findAllByType
(
4
));
return
unitsList
;
}
...
...
@@ -419,7 +418,7 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
List
<
Units
>
findSubordinateList
(
Integer
unitsId
)
{
Units
units
=
unitsDao
.
findById
(
unitsId
).
get
();
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
areaIds
=
areaDao
.
findAllByFatherId
(
units
.
getAreaId
()).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
map
(
Area:
:
getId
).
collect
(
Collectors
.
toList
());
return
unitsDao
.
findAllByAreaIdIn
(
areaIds
);
}
...
...
@@ -430,14 +429,30 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public
void
addUnitSortMap
()
{
DeviceModelSort
.
mapUnitSort
=
unitsDao
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getName
,
Units:
:
getShowOrder
));
DeviceModelSort
.
mapUnitNameToDisName
=
unitsDao
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getName
,
Units:
:
getUnitDesc
));
DeviceModelSort
.
mapUnitSort
=
unitsDao
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getName
,
Units:
:
getShowOrder
));
DeviceModelSort
.
mapUnitNameToDisName
=
unitsDao
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getName
,
Units:
:
getUnitDesc
));
}
/**
* 判断该unit是否是省本级单位
*
* @param unitId 单位主键id
* @return true = 省本级单位 , false = 不是省本级单位
*/
@Override
public
boolean
isProvUnit
(
Integer
unitId
)
{
Units
units
=
unitsDao
.
findById
(
unitId
).
get
();
if
(
units
.
getLevel
()
==
1
&&
units
.
getType
()
==
1
)
{
return
true
;
}
else
{
return
false
;
}
}
@Override
public
Units
save
(
Units
units
)
{
if
(
units
.
getAreaId
()
!=
null
&&
units
.
getAreaId
()!=
0
)
{
if
(
units
.
getAreaId
()
!=
null
&&
units
.
getAreaId
()
!=
0
)
{
Optional
<
Area
>
optionalArea
=
areaDao
.
findById
(
units
.
getAreaId
());
if
(
optionalArea
.
isPresent
())
{
units
.
setLevel
(
optionalArea
.
get
().
getType
());
...
...
@@ -445,13 +460,12 @@ public class UnitsServiceImpl implements UnitsService {
}
else
{
throw
new
ApiException
(
ResponseEntity
.
ok
(
"[单位] 没找到对应的区域,请检查"
));
}
}
else
{
}
else
{
units
.
setLevel
(
4
);
units
.
setType
(
3
);
}
Integer
maxShowCode
=
unitsDao
.
findTopByOrderByShowOrderDesc
().
getShowOrder
();
units
.
setShowOrder
(
maxShowCode
+
1
);
Integer
maxShowCode
=
unitsDao
.
findTopByOrderByShowOrderDesc
().
getShowOrder
();
units
.
setShowOrder
(
maxShowCode
+
1
);
Units
units1
=
unitsDao
.
save
(
units
);
unitsCache
.
refresh
(
unitsDao
.
findAll
());
return
units1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论