Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
operation-control-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王锦盛
operation-control-platform
Commits
d1401310
Commit
d1401310
authored
Apr 06, 2022
by
胡秀武
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型列表增加统推自建
parent
50c28b0a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
33 deletions
+59
-33
src/main/java/com/pms/ocp/model/entity/TreeNode.java
src/main/java/com/pms/ocp/model/entity/TreeNode.java
+7
-2
src/main/java/com/pms/ocp/model/vo/ModelListNavigationVO.java
...main/java/com/pms/ocp/model/vo/ModelListNavigationVO.java
+19
-0
src/main/java/com/pms/ocp/service/ModelSubscribeService.java
src/main/java/com/pms/ocp/service/ModelSubscribeService.java
+0
-8
src/main/java/com/pms/ocp/service/impl/ModelSubscribeServiceImpl.java
...a/com/pms/ocp/service/impl/ModelSubscribeServiceImpl.java
+29
-20
src/main/resources/mapper/ModelSubscribeMapper.xml
src/main/resources/mapper/ModelSubscribeMapper.xml
+3
-2
src/main/resources/mapper/PmsApiAuditMapper.xml
src/main/resources/mapper/PmsApiAuditMapper.xml
+1
-1
No files found.
src/main/java/com/pms/ocp/model/entity/TreeNode.java
View file @
d1401310
...
@@ -40,11 +40,12 @@ public class TreeNode implements Serializable {
...
@@ -40,11 +40,12 @@ public class TreeNode implements Serializable {
@ApiModelProperty
(
"子类"
)
@ApiModelProperty
(
"子类"
)
private
int
belongLevel
;
private
int
belongLevel
;
@ApiModelProperty
(
"统推,自建"
)
private
Integer
modelPromotion
;
@ApiModelProperty
(
"子类"
)
@ApiModelProperty
(
"子类"
)
private
List
<
TreeNode
>
children
;
private
List
<
TreeNode
>
children
;
public
String
getCode
()
{
public
String
getCode
()
{
return
code
==
null
?
""
:
code
;
return
code
==
null
?
""
:
code
;
}
}
...
@@ -55,6 +56,10 @@ public class TreeNode implements Serializable {
...
@@ -55,6 +56,10 @@ public class TreeNode implements Serializable {
return
companyCode
==
null
?
""
:
companyCode
;
return
companyCode
==
null
?
""
:
companyCode
;
}
}
public
Integer
getModelPromotion
()
{
return
modelPromotion
==
null
?
-
1
:
modelPromotion
;
}
public
String
getModelGroupCode
()
{
public
String
getModelGroupCode
()
{
return
modelGroupCode
==
null
?
""
:
modelGroupCode
;
return
modelGroupCode
==
null
?
""
:
modelGroupCode
;
}
}
...
...
src/main/java/com/pms/ocp/model/vo/ModelListNavigationVO.java
0 → 100644
View file @
d1401310
package
com.pms.ocp.model.vo
;
import
lombok.Data
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* @author huxiuwu
* @version 1.0
* @date 2022/4/2 15:28
*/
@Data
public
class
ModelListNavigationVO
<
T
>
{
//统推
private
List
<
T
>
unifiedPush
=
new
LinkedList
<>();
//自建
private
List
<
T
>
selfBuilt
=
new
LinkedList
<>();
}
src/main/java/com/pms/ocp/service/ModelSubscribeService.java
View file @
d1401310
...
@@ -53,14 +53,6 @@ public interface ModelSubscribeService {
...
@@ -53,14 +53,6 @@ public interface ModelSubscribeService {
*/
*/
List
<
ModelSubscribe
>
getModelSubscribeList
(
String
objId
,
String
modelCode
,
String
subsCompanyCode
);
List
<
ModelSubscribe
>
getModelSubscribeList
(
String
objId
,
String
modelCode
,
String
subsCompanyCode
);
/**
* 获取模型订阅列表
*
* @param modelId
* @return
*/
ModelSubscribeDTO
getModelSubscribe
(
String
modelId
);
ResponseVO
modelListNavigation
(
String
searchCondition
);
ResponseVO
modelListNavigation
(
String
searchCondition
);
}
}
src/main/java/com/pms/ocp/service/impl/ModelSubscribeServiceImpl.java
View file @
d1401310
package
com.pms.ocp.service.impl
;
package
com.pms.ocp.service.impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.pms.ocp.common.constants.Co
deEnum
;
import
com.pms.ocp.common.constants.Co
nstant
;
import
com.pms.ocp.common.utils.TreeUtils
;
import
com.pms.ocp.common.utils.TreeUtils
;
import
com.pms.ocp.mapper.ModelSubscribeMapper
;
import
com.pms.ocp.mapper.ModelSubscribeMapper
;
import
com.pms.ocp.model.dto.ModelSubscribeDTO
;
import
com.pms.ocp.model.dto.ModelSubscribeDTO
;
import
com.pms.ocp.model.entity.ModelSubscribe
;
import
com.pms.ocp.model.entity.ModelSubscribe
;
import
com.pms.ocp.model.entity.TreeNode
;
import
com.pms.ocp.model.entity.TreeNode
;
import
com.pms.ocp.model.vo.ModelListNavigationVO
;
import
com.pms.ocp.model.vo.ResponseVO
;
import
com.pms.ocp.model.vo.ResponseVO
;
import
com.pms.ocp.service.ModelSubscribeService
;
import
com.pms.ocp.service.ModelSubscribeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -18,7 +18,9 @@ import javax.annotation.Resource;
...
@@ -18,7 +18,9 @@ import javax.annotation.Resource;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.BiFunction
;
import
java.util.function.BiFunction
;
import
java.util.stream.Collectors
;
/**
/**
* @Auther: wangjian
* @Auther: wangjian
...
@@ -84,12 +86,6 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
...
@@ -84,12 +86,6 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
return
modelSubscribeMapper
.
selectList
(
queryWrapper
);
return
modelSubscribeMapper
.
selectList
(
queryWrapper
);
}
}
@Override
public
ModelSubscribeDTO
getModelSubscribe
(
String
modelId
)
{
return
null
;
}
/**
/**
* 服务列表导航树
* 服务列表导航树
* @author huxiuwu
* @author huxiuwu
...
@@ -99,26 +95,39 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
...
@@ -99,26 +95,39 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
**/
**/
@Override
@Override
public
ResponseVO
modelListNavigation
(
String
searchCondition
)
{
public
ResponseVO
modelListNavigation
(
String
searchCondition
)
{
ModelListNavigationVO
<
TreeNode
>
modelNavigationVO
=
new
ModelListNavigationVO
<>();
//查询模型和模型属性表列表
//查询模型和模型属性表列表
List
<
TreeNode
>
modelGroupList
=
modelSubscribeMapper
.
selectModelAndModelGroup
();
List
<
TreeNode
>
modelGroupList
=
modelSubscribeMapper
.
selectModelAndModelGroup
();
List
<
TreeNode
>
modelList
=
modelSubscribeMapper
.
getModelList
(
searchCondition
);
List
<
TreeNode
>
modelList
=
modelSubscribeMapper
.
getModelList
(
searchCondition
);
List
<
TreeNode
>
groupAndChildrenList
=
setChildren
(
modelList
,
modelGroupList
,
(
org
,
group
)
->
//统推自建分组
org
.
getModelGroupCode
().
equals
(
group
.
getModelGroupCode
())
Map
<
Integer
,
List
<
TreeNode
>>
modelGroupMap
=
modelList
.
stream
().
collect
(
Collectors
.
groupingBy
(
TreeNode:
:
getModelPromotion
));
);
//统推list
if
(
CollectionUtil
.
isEmpty
(
groupAndChildrenList
)){
List
<
TreeNode
>
unifiedPushList
=
setChildren
(
HandlingNullPointers
(
modelGroupMap
.
get
(
Constant
.
Number
.
ZERO
)),
modelGroupList
,(
org
,
group
)
->
return
ResponseVO
.
error
(
CodeEnum
.
NO_DATA
);
org
.
getModelGroupCode
().
equals
(
group
.
getModelGroupCode
()));
}
List
<
TreeNode
>
newModelGroupList
=
TreeUtils
.
build
(
unifiedPushList
);
List
<
TreeNode
>
newModelGroupList
=
TreeUtils
.
build
(
groupAndChildrenList
);
modelNavigationVO
.
setUnifiedPush
(
newModelGroupList
);
List
<
TreeNode
>
selfModelBuildList
=
setChildren
(
HandlingNullPointers
(
modelGroupMap
.
get
(
Constant
.
Number
.
ONE
)),
modelGroupList
,(
org
,
group
)
->
org
.
getModelGroupCode
().
equals
(
group
.
getModelGroupCode
()));
//查询组织机构表
//查询组织机构表
List
<
TreeNode
>
organList
=
modelSubscribeMapper
.
selectOrganData
();
List
<
TreeNode
>
organList
=
modelSubscribeMapper
.
selectOrganData
();
//将分类放入各自所属于的组织机构下
//将分类放入各自所属于的组织机构下
List
<
TreeNode
>
groupOrgList
=
setChildren
(
newModelGroup
List
,
organList
,(
org
,
group
)
->
List
<
TreeNode
>
groupOrgList
=
setChildren
(
selfModelBuild
List
,
organList
,(
org
,
group
)
->
org
.
getCompanyCode
().
equals
(
group
.
getCompanyCode
())
org
.
getCompanyCode
().
equals
(
group
.
getCompanyCode
())
);
);
List
<
TreeNode
>
result
=
TreeUtils
.
build
(
groupOrgList
);
List
<
TreeNode
>
selfBuildList
=
TreeUtils
.
build
(
groupOrgList
);
return
ResponseVO
.
ok
(
result
);
modelNavigationVO
.
setSelfBuilt
(
selfBuildList
);
return
ResponseVO
.
ok
(
modelNavigationVO
);
}
/**
* 处理空指针问题
* @author huxiuwu
* @date 2022/4/6
* @param list
* @return List<com.pms.ocp.model.entity.TreeNode>
**/
private
List
<
TreeNode
>
HandlingNullPointers
(
List
<
TreeNode
>
list
){
return
list
==
null
?
new
LinkedList
<>()
:
list
;
}
}
/**
/**
* 合并list设置子类
* 合并list设置子类
* @param modelGroupList
* @param modelGroupList
...
@@ -129,7 +138,7 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
...
@@ -129,7 +138,7 @@ public class ModelSubscribeServiceImpl implements ModelSubscribeService {
private
List
<
TreeNode
>
setChildren
(
List
<
TreeNode
>
modelGroupList
,
List
<
TreeNode
>
organList
,
BiFunction
<
TreeNode
,
TreeNode
,
Boolean
>
function
)
{
private
List
<
TreeNode
>
setChildren
(
List
<
TreeNode
>
modelGroupList
,
List
<
TreeNode
>
organList
,
BiFunction
<
TreeNode
,
TreeNode
,
Boolean
>
function
)
{
organList
.
forEach
(
org
->
{
organList
.
forEach
(
org
->
{
modelGroupList
.
forEach
(
group
->
{
modelGroupList
.
forEach
(
group
->
{
if
(
function
.
apply
(
org
,
group
))
{
if
(
function
.
apply
(
org
,
group
)
)
{
if
(
org
.
getChildren
()
==
null
)
{
if
(
org
.
getChildren
()
==
null
)
{
org
.
setChildren
(
new
LinkedList
<>());
org
.
setChildren
(
new
LinkedList
<>());
}
}
...
...
src/main/resources/mapper/ModelSubscribeMapper.xml
View file @
d1401310
...
@@ -18,7 +18,8 @@
...
@@ -18,7 +18,8 @@
3 as belongLevel,
3 as belongLevel,
model_name as name ,
model_name as name ,
model_code as code,
model_code as code,
model_group_code as modelGroupCode
model_group_code as modelGroupCode,
model_promotion as modelPromotion
from
from
ocp_model_base
ocp_model_base
<if
test=
"searchCondition != null and searchCondition != '' "
>
<if
test=
"searchCondition != null and searchCondition != '' "
>
...
@@ -34,7 +35,7 @@
...
@@ -34,7 +35,7 @@
org_id AS code,
org_id AS code,
org_code AS companyCode
org_code AS companyCode
from
from
t_public
_organization
ocp
_organization
where
where
trim(org_level) != ''
trim(org_level) != ''
and
and
...
...
src/main/resources/mapper/PmsApiAuditMapper.xml
View file @
d1401310
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
is_delete,
is_delete,
apply_version,
apply_version,
pre_api_version
pre_api_version
from ocp_api_audit
from ocp_api_audit
</select>
</select>
<select
id=
"sById"
resultType=
"com.pms.ocp.model.entity.PmsApiAudit"
>
<select
id=
"sById"
resultType=
"com.pms.ocp.model.entity.PmsApiAudit"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment