Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
map-parent
Commits
99c58b4d
Commit
99c58b4d
authored
Jun 30, 2023
by
宋珺琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
条件查询可视化服务信息
parent
1a927285
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
213 additions
and
4 deletions
+213
-4
common/common_utils/src/main/java/com/founder/commonutils/model/newPublicEntity/kshEntity/KshServiceCache.java
+11
-2
common/service_base/src/main/java/com/founder/servicebase/controller/KshServiceController.java
+14
-1
common/service_base/src/main/java/com/founder/servicebase/service/KshCacheService.java
+4
-0
common/service_base/src/main/java/com/founder/servicebase/service/serviceimpl/KshCacheServiceImpl.java
+157
-1
service/publicapi/src/main/java/com/founder/publicapi/mapper/mysqlMapper/DataStatisticsMapperCqxz.java
+4
-0
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/DataStatisticsServiceImpl.java
+23
-0
No files found.
common/common_utils/src/main/java/com/founder/commonutils/model/newPublicEntity/kshEntity/KshServiceCache.java
View file @
99c58b4d
...
...
@@ -69,8 +69,17 @@ public class KshServiceCache implements Serializable {
@TableField
(
exist
=
false
)
private
int
pageSize
;
//最后三个用于多维查找筛选条件
@ApiModelProperty
(
value
=
"导出时间格式转换备用字段"
)
@TableField
(
exist
=
false
)
private
String
byzd1
;
private
String
byzd1
;
//前端传大于小于等于
@ApiModelProperty
(
value
=
"前端页面查询传参"
)
@TableField
(
exist
=
false
)
private
String
param
;
@ApiModelProperty
(
value
=
"前端页面查询类型"
)
@TableField
(
exist
=
false
)
private
String
paramType
;
}
common/service_base/src/main/java/com/founder/servicebase/controller/KshServiceController.java
View file @
99c58b4d
...
...
@@ -122,7 +122,7 @@ public class KshServiceController extends ApiController {
if
(
update
)
{
return
new
MapRestResult
();
}
else
{
return
new
MapRestResult
(
).
error
(
"更新失败"
);
return
new
MapRestResult
(
200
,
"无此xxzjbh"
,
null
);
}
}
...
...
@@ -533,5 +533,18 @@ public class KshServiceController extends ApiController {
return
new
MapRestResult
().
error
(
"更新失败"
);
}
}
//筛选的时候前端传跟保存一样的内容就行
//后端封装数据 根节点不变
//查找对象 从nodes里筛选 重新构建links
//查找关系 从
@PostMapping
(
"findKshCache"
)
@ApiOperation
(
value
=
"多维情报_条件查询可视化服务信息"
)
@OperLog
(
message
=
"多维情报_条件查询可视化服务信息"
,
operation
=
OperationType
.
QUERY
)
public
MapRestResult
findKshCache
(
@RequestBody
KshServiceCache
kshServiceCache
)
{
return
kshCacheService
.
getfFindKshCache
(
kshServiceCache
);
}
}
common/service_base/src/main/java/com/founder/servicebase/service/KshCacheService.java
View file @
99c58b4d
package
com
.
founder
.
servicebase
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.founder.commonutils.model.newPublicEntity.MapRestResult
;
import
com.founder.commonutils.model.newPublicEntity.kshEntity.KshServiceCache
;
/**
...
...
@@ -11,5 +12,8 @@ import com.founder.commonutils.model.newPublicEntity.kshEntity.KshServiceCache;
*/
public
interface
KshCacheService
extends
IService
<
KshServiceCache
>
{
int
deleteKshCacheById
(
String
xxzjbh
);
//条件查询可视化服务信息
MapRestResult
getfFindKshCache
(
KshServiceCache
kshServiceCache
);
}
common/service_base/src/main/java/com/founder/servicebase/service/serviceimpl/KshCacheServiceImpl.java
View file @
99c58b4d
package
com
.
founder
.
servicebase
.
service
.
serviceimpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.founder.commonutils.model.newPublicEntity.MapRestResult
;
import
com.founder.commonutils.model.newPublicEntity.kshEntity.KshServiceCache
;
import
com.founder.commonutils.model.newPublicEntity.kshResult.KshTreeResultPojo
;
import
com.founder.servicebase.mapper.mysqlMapper.KshCacheMapper
;
import
com.founder.servicebase.mapper.mysqlMapper.KshMapper
;
import
com.founder.servicebase.service.KshCacheService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
/**
* 服务列表(SkService)表服务实现类
*
...
...
@@ -24,5 +30,155 @@ public class KshCacheServiceImpl extends ServiceImpl<KshCacheMapper, KshServiceC
public
int
deleteKshCacheById
(
String
xxzjbh
)
{
return
kshCacheMapper
.
deleteById
(
xxzjbh
);
}
//条件查询可视化服务信息
@Override
public
MapRestResult
getfFindKshCache
(
KshServiceCache
kshServiceCache
)
{
KshTreeResultPojo
ResultPojo
=
new
KshTreeResultPojo
();
//定义要返回的可视化数据
List
<
KshTreeResultPojo
.
Nodes
>
ResultNodes
=
new
ArrayList
<
KshTreeResultPojo
.
Nodes
>();
List
<
KshTreeResultPojo
.
Links
>
ResultLinks
=
new
ArrayList
<
KshTreeResultPojo
.
Links
>();
//前端要查询的字段
String
param
=
kshServiceCache
.
getParam
();
//前端要查询的类型
String
type
=
kshServiceCache
.
getParamType
();
if
(
StringUtils
.
isEmpty
(
param
)
||
StringUtils
.
isEmpty
(
type
)){
return
new
MapRestResult
(
200
,
"请输入筛选条件"
,
null
);
}
String
byzd1
=
kshServiceCache
.
getByzd1
();
//大于小于等于
//获取可视化数据
KshTreeResultPojo
kshdata
=
kshServiceCache
.
getKshdata
();
List
<
KshTreeResultPojo
.
Nodes
>
nodes
=
kshdata
.
getNodes
();
//nodes
List
<
KshTreeResultPojo
.
Links
>
links
=
kshdata
.
getLinks
();
//links
//获取所有的link中source并去重 就是根节点的id
Set
<
String
>
collect
=
kshdata
.
getLinks
().
stream
()
.
map
(
KshTreeResultPojo
.
Links
::
getSource
)
.
collect
(
Collectors
.
toSet
());
if
(
collect
.
size
()
==
0
)
{
return
new
MapRestResult
(
200
,
"没找到对应的数据"
,
null
);
}
//在node中对应的id 就是根节点
//存放node的id 为了查询links
HashSet
<
String
>
ids
=
new
HashSet
<>();
// 过滤节点数组,找到每个根节点
nodes
.
forEach
(
node
->
{
for
(
String
s
:
collect
)
{
if
(
node
.
getId
().
equals
(
s
))
{
//添加根节点
ResultNodes
.
add
(
node
);
//存放根节点id
ids
.
add
(
node
.
getId
());
}
}
});
// =========ResultNodes已经添加上根节点
if
(
type
.
equals
(
"nodes"
))
{
//查找对象
AtomicInteger
i
=
new
AtomicInteger
(
1
);
nodes
.
forEach
(
node
->
{
//添加筛选的节点 根nodes中的lable来模糊查
if
(
node
.
getLabel
().
contains
(
param
))
{
i
.
getAndIncrement
();
ResultNodes
.
add
(
node
);
ids
.
add
(
node
.
getId
());
}
});
if
(
i
.
get
()
==
1
)
{
return
new
MapRestResult
(
200
,
"没找到对应的数据"
,
null
);
}
//最后nodes根据id去重 避免根节点包含param
List
<
KshTreeResultPojo
.
Nodes
>
collect1
=
ResultNodes
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(
()
->
new
TreeSet
<>(
Comparator
.
comparing
(
tc
->
tc
.
getId
())
)),
ArrayList:
:
new
));
// --------nodes结束---------
//在links的target中找对应的nodesid
links
.
forEach
(
link
->
{
for
(
String
id
:
ids
)
{
if
(
link
.
getTarget
().
equals
(
id
))
{
//添加根节点
ResultLinks
.
add
(
link
);
}
}
});
//---------links结束----------
ResultPojo
.
setNodes
(
collect1
);
ResultPojo
.
setLinks
(
ResultLinks
);
}
else
if
(
type
.
equals
(
"links"
))
{
//查找关系
//links中lable是关系数据
AtomicInteger
i
=
new
AtomicInteger
(
1
);
links
.
forEach
(
link
->
{
//添加符合关系的数据
if
(
link
.
getLabel
().
contains
(
param
))
{
i
.
getAndIncrement
();
ResultLinks
.
add
(
link
);
}
});
if
(
i
.
get
()
==
1
)
{
return
new
MapRestResult
(
200
,
"没找到对应的数据"
,
null
);
}
//遍历ResultLinks 获取和target所有 nodes中对应id获取对应的数据 ---ResultNodes 已经有根节点
nodes
.
forEach
(
n
->
{
ResultLinks
.
forEach
(
l
->
{
if
(
n
.
getId
().
equals
(
l
.
getTarget
()))
{
ResultNodes
.
add
(
n
);
}
});
});
ResultPojo
.
setNodes
(
ResultNodes
);
ResultPojo
.
setLinks
(
ResultLinks
);
}
else
if
(
type
.
equals
(
"searchValue"
))
{
//筛选关系个数节点
//根据source对links分组 来判断有关系节点
Map
<
String
,
List
<
KshTreeResultPojo
.
Links
>>
collect1
=
links
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
KshTreeResultPojo
.
Links
::
getSource
));
//设置link
for
(
Map
.
Entry
<
String
,
List
<
KshTreeResultPojo
.
Links
>>
s
:
collect1
.
entrySet
())
{
int
size
=
s
.
getValue
().
size
();
if
(
byzd1
.
equals
(
"大于"
)
&&
size
>
Integer
.
valueOf
(
param
))
{
for
(
KshTreeResultPojo
.
Links
links1
:
s
.
getValue
())
{
ResultLinks
.
add
(
links1
);
}
}
else
if
(
byzd1
.
equals
(
"小于"
)
&&
size
<
Integer
.
valueOf
(
param
))
{
for
(
KshTreeResultPojo
.
Links
links1
:
s
.
getValue
())
{
ResultLinks
.
add
(
links1
);
}
}
else
if
(
byzd1
.
equals
(
"等于"
)
&&
(
size
==
Integer
.
valueOf
(
param
)))
{
for
(
KshTreeResultPojo
.
Links
links1
:
s
.
getValue
())
{
ResultLinks
.
add
(
links1
);
}
}
}
if
(
ResultLinks
.
size
()
==
0
)
{
return
new
MapRestResult
(
200
,
"没找到对应的数据"
,
null
);
}
//遍历ResultLinks获取target target= node。id
Set
<
String
>
targets
=
ResultLinks
.
stream
()
.
map
(
KshTreeResultPojo
.
Links
::
getTarget
)
.
collect
(
Collectors
.
toSet
());
//遍历nodes去获取对应的node
nodes
.
forEach
(
node
->{
targets
.
forEach
(
target
->{
if
(
node
.
getId
().
equals
(
target
)){
ResultNodes
.
add
(
node
);
}
});
});
ResultPojo
.
setNodes
(
ResultNodes
);
ResultPojo
.
setLinks
(
ResultLinks
);
}
return
new
MapRestResult
(
ResultPojo
);
}
}
service/publicapi/src/main/java/com/founder/publicapi/mapper/mysqlMapper/DataStatisticsMapperCqxz.java
View file @
99c58b4d
...
...
@@ -26,4 +26,8 @@ public interface DataStatisticsMapperCqxz {
//环比
List
<
Map
<
String
,
Object
>>
getQYLaCDount
(
DataStatisticsParams
params
);
List
<
String
>
getCodeList2
(
String
code
,
String
type
);
}
service/publicapi/src/main/java/com/founder/publicapi/service/serviceimpl/DataStatisticsServiceImpl.java
View file @
99c58b4d
...
...
@@ -802,6 +802,29 @@ public class DataStatisticsServiceImpl implements DataStatisticsService {
return
list
;
}
public
static
void
main
(
String
[]
args
)
{
String
ms
=
"00%-10%"
;
final
String
substring
=
ms
.
substring
(
4
,
7
);
System
.
out
.
println
(
substring
);
int
endIndex
=
ms
.
length
();
// 获取字符串的长度作为结束索引位置
int
beginIndex
=
endIndex
-
3
;
// 计算开始索引位置
String
result
=
ms
.
substring
(
beginIndex
,
endIndex
);
// 截取子字符串
System
.
out
.
println
(
result
);
// 查找 "-" 的位置,加 1 得到它后面的位置
int
index
=
ms
.
indexOf
(
"-"
)
+
1
;
// 截取 "-" 后面的字符串
String
result1
=
ms
.
substring
(
index
);
System
.
out
.
println
(
result1
);
// 输出:10%
String
s
=
"11%"
;
float
bfs
=
Float
.
valueOf
(
String
.
valueOf
(
s
).
replace
(
"%"
,
""
));
// float bfs1 = Float.valueOf(String.valueOf(ms).replace("%", ""));
System
.
out
.
println
(
bfs
);
}
}
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