Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ad200398
提交
ad200398
authored
7月 15, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 过滤组件弹框样式错位
上级
d51029bc
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
66 行增加
和
18 行删除
+66
-18
MapApi.java
backend/src/main/java/io/dataease/map/api/MapApi.java
+9
-0
MapServer.java
backend/src/main/java/io/dataease/map/server/MapServer.java
+9
-4
MapService.java
...end/src/main/java/io/dataease/map/service/MapService.java
+2
-0
MapUtils.java
backend/src/main/java/io/dataease/map/utils/MapUtils.java
+42
-10
filterDialog.vue
frontend/src/views/panel/filter/filterDialog.vue
+4
-4
没有找到文件。
backend/src/main/java/io/dataease/map/api/MapApi.java
浏览文件 @
ad200398
...
...
@@ -18,4 +18,13 @@ public interface MapApi {
@GetMapping
(
"/areaEntitys/{pcode}"
)
List
<
AreaEntity
>
areaEntitys
(
@PathVariable
String
pcode
);
/**
* 由于api有限流机制
* 请求失败后 调用重试方法
* @param areaCode
*/
@GetMapping
(
"/retry/{areaCode}"
)
void
retry
(
@PathVariable
String
areaCode
);
}
backend/src/main/java/io/dataease/map/server/MapServer.java
浏览文件 @
ad200398
...
...
@@ -8,6 +8,7 @@ import io.dataease.map.utils.MapUtils;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
...
...
@@ -41,10 +42,14 @@ public class MapServer implements MapApi {
List
<
AreaEntity
>
areaEntities
=
mapService
.
areaEntities
();
return
mapService
.
entitysByPid
(
areaEntities
,
pcode
);
}
/*return areaEntities.stream().filter(item -> StringUtils.equals(item.getPcode(), pcode)).map(item -> {
item.setChildren(null);
return item;
}).collect(Collectors.toList());*/
@Override
public
void
retry
(
@PathVariable
String
areaCode
)
{
List
<
AreaEntity
>
areaEntities
=
mapService
.
areaEntities
();
AreaEntity
areaEntity
=
MapUtils
.
nodeByCode
(
areaEntities
,
areaCode
);
List
<
AreaEntity
>
targets
=
new
ArrayList
<>();
targets
.
add
(
areaEntity
);
MapUtils
.
recursionWriteFull
(
targets
);
}
}
backend/src/main/java/io/dataease/map/service/MapService.java
浏览文件 @
ad200398
...
...
@@ -48,4 +48,6 @@ public class MapService {
}
}
backend/src/main/java/io/dataease/map/utils/MapUtils.java
浏览文件 @
ad200398
...
...
@@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
import
io.dataease.base.domain.AreaMapping
;
import
io.dataease.base.domain.AreaMappingExample
;
import
io.dataease.base.mapper.AreaMappingMapper
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.map.dto.entity.*
;
import
io.dataease.map.dto.entity.Properties
;
import
io.dataease.map.dto.response.MapResponse
;
...
...
@@ -15,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
@Component
...
...
@@ -68,7 +71,7 @@ public class MapUtils {
AreaEntity
china
=
root
();
maps
.
parallelStream
().
forEach
(
map
->
{
// maps.stream().forEach(map -> {
// maps.stream().forEach(map -> {
String
province_code
=
map
.
get
(
Constants
.
PROVINCE_CODE
).
toString
();
String
city_code
=
map
.
get
(
Constants
.
CITY_CODE
).
toString
();
String
county_code
=
map
.
get
(
Constants
.
COUNTY_CODE
).
toString
();
...
...
@@ -77,6 +80,10 @@ public class MapUtils {
city_code
=
formatCode
(
city_code
);
county_code
=
formatCode
(
county_code
);
// 是否是跨级直辖
Boolean
isCrossLevel
=
StrUtil
.
equals
(
province_code
,
city_code
)
&&
!
StrUtil
.
equals
(
province_code
,
"710000"
);
if
(!
provinceMap
.
containsKey
(
province_code
))
{
String
province_name
=
map
.
get
(
Constants
.
PROVINCE_NAME
).
toString
();
AreaEntity
child
=
AreaEntity
.
builder
().
code
(
province_code
).
name
(
province_name
).
pcode
(
china
.
getCode
()).
build
();
...
...
@@ -86,20 +93,26 @@ public class MapUtils {
//当前省
AreaEntity
currentProvince
=
provinceMap
.
get
(
province_code
);
String
city_name
=
map
.
get
(
Constants
.
CITY_NAME
).
toString
();
if
(
isCrossLevel
)
{
city_code
=
county_code
;
city_name
=
map
.
get
(
Constants
.
COUNTY_NAME
).
toString
();
}
if
(!
cityMap
.
containsKey
(
city_code
))
{
String
city_name
=
map
.
get
(
Constants
.
CITY_NAME
).
toString
();
AreaEntity
child
=
AreaEntity
.
builder
().
code
(
city_code
).
name
(
city_name
).
pcode
(
currentProvince
.
getCode
()).
build
();
cityMap
.
put
(
city_code
,
child
);
currentProvince
.
addChild
(
child
);
}
//当前市
AreaEntity
currentCity
=
cityMap
.
get
(
city_code
);
if
(!
countyMap
.
containsKey
(
county_code
))
{
String
county_name
=
map
.
get
(
Constants
.
COUNTY_NAME
).
toString
();
AreaEntity
child
=
AreaEntity
.
builder
().
code
(
county_code
).
name
(
county_name
).
pcode
(
currentCity
.
getCode
()).
build
();
countyMap
.
put
(
county_code
,
child
);
currentCity
.
addChild
(
child
);
if
(!
isCrossLevel
)
{
//当前市
AreaEntity
currentCity
=
cityMap
.
get
(
city_code
);
if
(!
countyMap
.
containsKey
(
county_code
))
{
String
county_name
=
map
.
get
(
Constants
.
COUNTY_NAME
).
toString
();
AreaEntity
child
=
AreaEntity
.
builder
().
code
(
county_code
).
name
(
county_name
).
pcode
(
currentCity
.
getCode
()).
build
();
countyMap
.
put
(
county_code
,
child
);
currentCity
.
addChild
(
child
);
}
}
});
// List<AreaEntity> treeNodes = provinceMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
...
...
@@ -156,8 +169,11 @@ public class MapUtils {
List
<
Feature
>
kidFeatures
=
districts
.
stream
().
map
(
district
->
buildFeature
(
district
,
child
)).
collect
(
Collectors
.
toList
());
features
.
addAll
(
kidFeatures
);
}
}
else
{
LogUtil
.
error
(
"请求节点错误 请手动补偿: "
+
areaEntity
.
getName
()
+
" -> "
+
child
.
getName
());
}
});
if
(
CollectionUtil
.
isNotEmpty
(
features
))
{
MapResultDto
mapResultDto
=
buildGeometry
(
features
);
writeFeatureFileFull
(
mapResultDto
,
areaEntity
.
getCode
()
+
"_full"
);
...
...
@@ -249,4 +265,20 @@ public class MapUtils {
String
content
=
JSONUtil
.
toJsonStr
(
mapResultDto
);
fileWriter
.
write
(
content
);
}
public
static
AreaEntity
nodeByCode
(
List
<
AreaEntity
>
areaEntities
,
String
code
)
{
for
(
int
i
=
0
;
i
<
areaEntities
.
size
();
i
++)
{
AreaEntity
areaEntity
=
areaEntities
.
get
(
i
);
if
(
StrUtil
.
equals
(
areaEntity
.
getCode
(),
code
))
{
return
areaEntity
;
}
if
(
CollectionUtil
.
isNotEmpty
(
areaEntity
.
getChildren
()))
{
AreaEntity
temp
=
nodeByCode
(
areaEntity
.
getChildren
(),
code
);
if
(
null
!=
temp
){
return
temp
;
}
}
}
return
null
;
}
}
frontend/src/views/panel/filter/filterDialog.vue
浏览文件 @
ad200398
...
...
@@ -182,7 +182,7 @@
</div>
</el-col>
<el-col
:span=
"16"
><div
class=
"filter-options-right"
>
<
el-col
:span=
"8
"
>
<
span
style=
"padding-right: 10px;
"
>
<el-checkbox
v-model=
"componentInfo.options.attrs.showTitle"
@
change=
"showTitleChange"
>
显示标题
</el-checkbox>
<el-popover
v-model=
"titlePopovervisible"
...
...
@@ -196,8 +196,8 @@
<i
slot=
"reference"
:class=
"{'i-filter-active': componentInfo.options.attrs.showTitle, 'i-filter-inactive': !componentInfo.options.attrs.showTitle}"
class=
"el-icon-setting i-filter"
/>
</el-popover>
</
el-col
>
<
el-col
:span=
"8
"
>
</
span
>
<
span
style=
"padding-left: 10px;
"
>
<el-checkbox
v-model=
"componentInfo.options.attrs.enableRange"
@
change=
"enableRangeChange"
><span>
{{ $t('panel.custom_scope') }}
</span>
</el-checkbox>
<el-popover
...
...
@@ -219,7 +219,7 @@
<i
slot=
"reference"
:class=
"{'i-filter-active': componentInfo.options.attrs.enableRange, 'i-filter-inactive': !componentInfo.options.attrs.enableRange}"
class=
"el-icon-setting i-filter"
/>
</el-popover>
</
el-col
>
</
span
>
</div>
</el-col>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论