Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
b7683b25
Unverified
提交
b7683b25
authored
7月 13, 2021
作者:
fit2cloud-chenyw
提交者:
GitHub
7月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #232 from dataease/pr@dev@feat_map
feat: 添加测试地图
上级
8d144a48
84808a6e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
752 行增加
和
0 行删除
+752
-0
pom.xml
backend/pom.xml
+12
-0
AreaMapping.java
...nd/src/main/java/io/dataease/base/domain/AreaMapping.java
+24
-0
AreaMappingExample.java
...main/java/io/dataease/base/domain/AreaMappingExample.java
+0
-0
AreaMappingMapper.java
.../main/java/io/dataease/base/mapper/AreaMappingMapper.java
+31
-0
AreaMappingMapper.xml
...c/main/java/io/dataease/base/mapper/AreaMappingMapper.xml
+244
-0
MapApi.java
backend/src/main/java/io/dataease/map/api/MapApi.java
+21
-0
AreaEntity.java
.../src/main/java/io/dataease/map/dto/entity/AreaEntity.java
+30
-0
Constants.java
...d/src/main/java/io/dataease/map/dto/entity/Constants.java
+14
-0
District.java
...nd/src/main/java/io/dataease/map/dto/entity/District.java
+24
-0
Feature.java
...end/src/main/java/io/dataease/map/dto/entity/Feature.java
+15
-0
Geometry.java
...nd/src/main/java/io/dataease/map/dto/entity/Geometry.java
+17
-0
Parent.java
backend/src/main/java/io/dataease/map/dto/entity/Parent.java
+11
-0
Properties.java
.../src/main/java/io/dataease/map/dto/entity/Properties.java
+29
-0
MapRequest.java
...src/main/java/io/dataease/map/dto/request/MapRequest.java
+21
-0
MapResponse.java
...c/main/java/io/dataease/map/dto/response/MapResponse.java
+20
-0
MapResultDto.java
.../main/java/io/dataease/map/dto/response/MapResultDto.java
+16
-0
MapServer.java
backend/src/main/java/io/dataease/map/server/MapServer.java
+50
-0
MapService.java
...end/src/main/java/io/dataease/map/service/MapService.java
+51
-0
HttpUtils.java
backend/src/main/java/io/dataease/map/utils/HttpUtils.java
+40
-0
MapUtils.java
backend/src/main/java/io/dataease/map/utils/MapUtils.java
+0
-0
V14__area_code.sql
backend/src/main/resources/db/migration/V14__area_code.sql
+0
-0
ehcache.xml
backend/src/main/resources/ehcache/ehcache.xml
+11
-0
index.vue
frontend/src/views/system/map/index.vue
+71
-0
没有找到文件。
backend/pom.xml
浏览文件 @
b7683b25
...
...
@@ -370,6 +370,18 @@
<artifactId>
ST4
</artifactId>
<version>
4.0.8
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.4
</version>
</dependency>
<!--<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>-->
</dependencies>
<build>
...
...
backend/src/main/java/io/dataease/base/domain/AreaMapping.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
base
.
domain
;
import
java.io.Serializable
;
import
lombok.Data
;
@Data
public
class
AreaMapping
implements
Serializable
{
private
Long
id
;
private
String
provinceName
;
private
String
provinceCode
;
private
String
cityName
;
private
String
cityCode
;
private
String
countyName
;
private
String
countyCode
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/AreaMappingExample.java
0 → 100644
浏览文件 @
b7683b25
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/base/mapper/AreaMappingMapper.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
base
.
mapper
;
import
io.dataease.base.domain.AreaMapping
;
import
io.dataease.base.domain.AreaMappingExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
AreaMappingMapper
{
long
countByExample
(
AreaMappingExample
example
);
int
deleteByExample
(
AreaMappingExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AreaMapping
record
);
int
insertSelective
(
AreaMapping
record
);
List
<
AreaMapping
>
selectByExample
(
AreaMappingExample
example
);
AreaMapping
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
AreaMapping
record
,
@Param
(
"example"
)
AreaMappingExample
example
);
int
updateByExample
(
@Param
(
"record"
)
AreaMapping
record
,
@Param
(
"example"
)
AreaMappingExample
example
);
int
updateByPrimaryKeySelective
(
AreaMapping
record
);
int
updateByPrimaryKey
(
AreaMapping
record
);
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/AreaMappingMapper.xml
0 → 100644
浏览文件 @
b7683b25
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"io.dataease.base.mapper.AreaMappingMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.AreaMapping"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"province_name"
jdbcType=
"VARCHAR"
property=
"provinceName"
/>
<result
column=
"province_code"
jdbcType=
"VARCHAR"
property=
"provinceCode"
/>
<result
column=
"city_name"
jdbcType=
"VARCHAR"
property=
"cityName"
/>
<result
column=
"city_code"
jdbcType=
"VARCHAR"
property=
"cityCode"
/>
<result
column=
"county_name"
jdbcType=
"VARCHAR"
property=
"countyName"
/>
<result
column=
"county_code"
jdbcType=
"VARCHAR"
property=
"countyCode"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, province_name, province_code, city_name, city_code, county_name, county_code
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.AreaMappingExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from area_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from area_mapping
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from area_mapping
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.dataease.base.domain.AreaMappingExample"
>
delete from area_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.AreaMapping"
>
insert into area_mapping (id, province_name, province_code,
city_name, city_code, county_name,
county_code)
values (#{id,jdbcType=BIGINT}, #{provinceName,jdbcType=VARCHAR}, #{provinceCode,jdbcType=VARCHAR},
#{cityName,jdbcType=VARCHAR}, #{cityCode,jdbcType=VARCHAR}, #{countyName,jdbcType=VARCHAR},
#{countyCode,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.AreaMapping"
>
insert into area_mapping
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"provinceName != null"
>
province_name,
</if>
<if
test=
"provinceCode != null"
>
province_code,
</if>
<if
test=
"cityName != null"
>
city_name,
</if>
<if
test=
"cityCode != null"
>
city_code,
</if>
<if
test=
"countyName != null"
>
county_name,
</if>
<if
test=
"countyCode != null"
>
county_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"provinceName != null"
>
#{provinceName,jdbcType=VARCHAR},
</if>
<if
test=
"provinceCode != null"
>
#{provinceCode,jdbcType=VARCHAR},
</if>
<if
test=
"cityName != null"
>
#{cityName,jdbcType=VARCHAR},
</if>
<if
test=
"cityCode != null"
>
#{cityCode,jdbcType=VARCHAR},
</if>
<if
test=
"countyName != null"
>
#{countyName,jdbcType=VARCHAR},
</if>
<if
test=
"countyCode != null"
>
#{countyCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.AreaMappingExample"
resultType=
"java.lang.Long"
>
select count(*) from area_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update area_mapping
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.provinceName != null"
>
province_name = #{record.provinceName,jdbcType=VARCHAR},
</if>
<if
test=
"record.provinceCode != null"
>
province_code = #{record.provinceCode,jdbcType=VARCHAR},
</if>
<if
test=
"record.cityName != null"
>
city_name = #{record.cityName,jdbcType=VARCHAR},
</if>
<if
test=
"record.cityCode != null"
>
city_code = #{record.cityCode,jdbcType=VARCHAR},
</if>
<if
test=
"record.countyName != null"
>
county_name = #{record.countyName,jdbcType=VARCHAR},
</if>
<if
test=
"record.countyCode != null"
>
county_code = #{record.countyCode,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update area_mapping
set id = #{record.id,jdbcType=BIGINT},
province_name = #{record.provinceName,jdbcType=VARCHAR},
province_code = #{record.provinceCode,jdbcType=VARCHAR},
city_name = #{record.cityName,jdbcType=VARCHAR},
city_code = #{record.cityCode,jdbcType=VARCHAR},
county_name = #{record.countyName,jdbcType=VARCHAR},
county_code = #{record.countyCode,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.AreaMapping"
>
update area_mapping
<set>
<if
test=
"provinceName != null"
>
province_name = #{provinceName,jdbcType=VARCHAR},
</if>
<if
test=
"provinceCode != null"
>
province_code = #{provinceCode,jdbcType=VARCHAR},
</if>
<if
test=
"cityName != null"
>
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if
test=
"cityCode != null"
>
city_code = #{cityCode,jdbcType=VARCHAR},
</if>
<if
test=
"countyName != null"
>
county_name = #{countyName,jdbcType=VARCHAR},
</if>
<if
test=
"countyCode != null"
>
county_code = #{countyCode,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.AreaMapping"
>
update area_mapping
set province_name = #{provinceName,jdbcType=VARCHAR},
province_code = #{provinceCode,jdbcType=VARCHAR},
city_name = #{cityName,jdbcType=VARCHAR},
city_code = #{cityCode,jdbcType=VARCHAR},
county_name = #{countyName,jdbcType=VARCHAR},
county_code = #{countyCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/map/api/MapApi.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
api
;
import
io.dataease.map.dto.entity.AreaEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.List
;
@RequestMapping
(
"/api/map"
)
public
interface
MapApi
{
@GetMapping
(
"/resourceFull/{areaCode}"
)
String
resourceFull
(
@PathVariable
String
areaCode
);
@GetMapping
(
"/asyncGeometry"
)
String
asyncGeometry
();
@GetMapping
(
"/areaEntitys/{pcode}"
)
List
<
AreaEntity
>
areaEntitys
(
@PathVariable
String
pcode
);
}
backend/src/main/java/io/dataease/map/dto/entity/AreaEntity.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
@Data
@Builder
public
class
AreaEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1326667005437020282L
;
private
String
code
;
private
String
name
;
private
String
pcode
;
private
List
<
AreaEntity
>
children
;
public
void
addChild
(
AreaEntity
entity
)
{
children
=
Optional
.
ofNullable
(
children
).
orElse
(
new
ArrayList
<>());
entity
.
setPcode
(
code
);
children
.
add
(
entity
);
}
}
backend/src/main/java/io/dataease/map/dto/entity/Constants.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
public
class
Constants
{
public
static
final
String
PROVINCE_CODE
=
"省gb"
;
public
static
final
String
PROVINCE_NAME
=
"省name"
;
public
static
final
String
CITY_CODE
=
"市gb"
;
public
static
final
String
CITY_NAME
=
"市name"
;
public
static
final
String
COUNTY_CODE
=
"县gb"
;
public
static
final
String
COUNTY_NAME
=
"县name"
;
}
backend/src/main/java/io/dataease/map/dto/entity/District.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
District
{
private
String
adcode
;
private
String
center
;
private
String
citycode
;
private
String
level
;
private
String
name
;
private
String
polyline
;
private
List
<
District
>
districts
;
}
backend/src/main/java/io/dataease/map/dto/entity/Feature.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
Feature
implements
Serializable
{
private
String
type
;
private
Properties
properties
;
private
Geometry
geometry
;
}
backend/src/main/java/io/dataease/map/dto/entity/Geometry.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
Geometry
implements
Serializable
{
private
String
type
;
// 多个面构成
// point一维数组 polyline二维数组 polygon三维数组 MultiPolygon四维数组
private
List
<
List
<
List
<
List
<
Double
>>>>
coordinates
;
}
backend/src/main/java/io/dataease/map/dto/entity/Parent.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
Parent
implements
Serializable
{
private
String
adcode
;
}
backend/src/main/java/io/dataease/map/dto/entity/Properties.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
Properties
implements
Serializable
{
private
String
adcode
;
private
String
name
;
private
List
<
Double
>
center
;
private
List
<
Double
>
centroid
;
private
Integer
childrenNum
;
private
String
level
;
private
Parent
parent
;
private
Integer
subFeatureIndex
;
private
List
<
Double
>
acroutes
;
}
backend/src/main/java/io/dataease/map/dto/request/MapRequest.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
request
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@Builder
public
class
MapRequest
implements
Serializable
{
private
String
keywords
;
private
Integer
subdistrict
;
private
String
extensions
;
private
String
key
;
private
Integer
page
=
1
;
}
backend/src/main/java/io/dataease/map/dto/response/MapResponse.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
response
;
import
io.dataease.map.dto.entity.District
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MapResponse
{
private
String
status
;
private
String
info
;
private
String
infocode
;
private
String
count
;
private
List
<
District
>
districts
;
}
backend/src/main/java/io/dataease/map/dto/response/MapResultDto.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
dto
.
response
;
import
io.dataease.map.dto.entity.Feature
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
MapResultDto
implements
Serializable
{
private
String
type
;
private
List
<
Feature
>
features
;
}
backend/src/main/java/io/dataease/map/server/MapServer.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
server
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.map.api.MapApi
;
import
io.dataease.map.dto.entity.AreaEntity
;
import
io.dataease.map.service.MapService
;
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.List
;
@RestController
public
class
MapServer
implements
MapApi
{
@Resource
private
MapService
mapService
;
@Override
public
String
resourceFull
(
@PathVariable
String
areaCode
)
{
return
mapService
.
geometry
(
areaCode
);
}
@Override
public
String
asyncGeometry
()
{
try
{
// List<AreaEntity> areaEntities = MapUtils.readAreaEntity();
List
<
AreaEntity
>
areaEntities
=
mapService
.
areaEntities
();
MapUtils
.
recursionWriteFull
(
areaEntities
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
);
return
e
.
getMessage
();
}
return
"async success"
;
}
@Override
public
List
<
AreaEntity
>
areaEntitys
(
@PathVariable
String
pcode
)
{
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());*/
}
}
backend/src/main/java/io/dataease/map/service/MapService.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
service
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.file.FileReader
;
import
io.dataease.map.dto.entity.AreaEntity
;
import
io.dataease.map.utils.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
MapService
{
private
static
final
String
dirPath
=
"/opt/dataease/data/feature/"
;
// 要不要加缓存呢?
public
String
geometry
(
String
areaCode
)
{
String
path
=
dirPath
+
"full/"
+
areaCode
+
"_full.json"
;
FileReader
fileReader
=
new
FileReader
(
path
);
return
fileReader
.
readString
();
}
@Cacheable
(
"sys_map_areas"
)
public
List
<
AreaEntity
>
areaEntities
()
{
List
<
AreaEntity
>
areaEntities
=
MapUtils
.
readAreaEntity
();
return
areaEntities
;
}
public
List
<
AreaEntity
>
entitysByPid
(
List
<
AreaEntity
>
entities
,
String
pid
)
{
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++)
{
AreaEntity
areaEntity
=
entities
.
get
(
i
);
if
(
StringUtils
.
equals
(
pid
,
areaEntity
.
getCode
()))
{
return
areaEntity
.
getChildren
();
}
if
(
CollectionUtil
.
isNotEmpty
(
areaEntity
.
getChildren
()))
{
List
<
AreaEntity
>
areaEntities
=
entitysByPid
(
areaEntity
.
getChildren
(),
pid
);
if
(
null
!=
areaEntities
){
return
areaEntities
;
}
}
}
return
null
;
}
}
backend/src/main/java/io/dataease/map/utils/HttpUtils.java
0 → 100644
浏览文件 @
b7683b25
package
io
.
dataease
.
map
.
utils
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONUtil
;
import
io.dataease.map.dto.request.MapRequest
;
import
io.dataease.map.dto.response.MapResponse
;
import
java.util.Map
;
public
class
HttpUtils
{
private
static
final
String
url
=
"https://restapi.amap.com/v3/config/district"
;
private
static
final
String
key
=
"a5d10d5d05a3a0868cec67c4d66cf025"
;
private
static
final
String
extensions
=
"all"
;
private
static
final
Integer
subdistrict
=
0
;
public
static
MapResponse
get
(
MapRequest
request
){
request
.
setKey
(
key
);
request
.
setExtensions
(
extensions
);
request
.
setSubdistrict
(
subdistrict
);
Map
<
String
,
Object
>
param
=
BeanUtil
.
beanToMap
(
request
);
String
s
=
HttpUtil
.
get
(
url
,
param
);
MapResponse
mapResponse
=
JSONUtil
.
toBean
(
s
,
MapResponse
.
class
);
return
mapResponse
;
}
public
static
MapResponse
get
(
String
code
)
{
MapRequest
request
=
MapRequest
.
builder
().
keywords
(
code
).
build
();
return
get
(
request
);
}
}
backend/src/main/java/io/dataease/map/utils/MapUtils.java
0 → 100644
浏览文件 @
b7683b25
差异被折叠。
点击展开。
backend/src/main/resources/db/migration/V14__area_code.sql
0 → 100644
浏览文件 @
b7683b25
This source diff could not be displayed because it is too large. You can
view the blob
instead.
backend/src/main/resources/ehcache/ehcache.xml
浏览文件 @
b7683b25
...
...
@@ -128,5 +128,15 @@
memoryStoreEvictionPolicy=
"LRU"
/>
<!--消息类型缓存-->
<cache
name=
"sys_map_areas"
eternal=
"true"
maxElementsInMemory=
"100"
maxElementsOnDisk=
"3000"
overflowToDisk=
"true"
diskPersistent=
"false"
/>
</ehcache>
\ No newline at end of file
frontend/src/views/system/map/index.vue
0 → 100644
浏览文件 @
b7683b25
<
template
>
<layout-content
v-loading=
"$store.getters.loadingMap[$store.getters.currentPath]"
>
<div
id=
"maptest"
style=
"width: 100%;height:100%;"
/>
</layout-content>
</
template
>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
{
get
}
from
'@/api/panel/panel'
export
default
{
components
:
{
LayoutContent
},
data
()
{
return
{
myChart
:
null
,
defaultPcode
:
'100000'
,
mapurl
:
'/api/map/resourceFull/'
}
},
created
()
{
},
mounted
()
{
const
chartDom
=
document
.
getElementById
(
'maptest'
)
this
.
myChart
=
this
.
$echarts
.
init
(
chartDom
)
this
.
initMap
(
this
.
defaultPcode
)
},
methods
:
{
initMap
(
pcode
)
{
this
.
myChart
.
showLoading
()
get
(
this
.
mapurl
+
pcode
).
then
(
res
=>
{
this
.
myChart
.
hideLoading
()
const
geoJson
=
res
.
data
this
.
$echarts
.
registerMap
(
'HK'
,
geoJson
)
this
.
myChart
.
setOption
({
series
:
[
{
type
:
'map'
,
map
:
'HK'
,
// 自定义扩展图表类型
roam
:
true
,
label
:
{
show
:
false
},
nameProperty
:
'name'
}
]
})
this
.
queryAreaCodes
(
pcode
).
then
(
res
=>
{
const
areaEntitys
=
res
.
data
this
.
myChart
.
on
(
'click'
,
param
=>
{
const
name
=
param
.
name
for
(
let
index
=
0
;
index
<
areaEntitys
.
length
;
index
++
)
{
const
element
=
areaEntitys
[
index
]
if
(
element
.
name
===
name
)
{
this
.
initMap
(
element
.
code
)
}
}
})
})
})
},
queryAreaCodes
(
pcode
)
{
return
get
(
'/api/map/areaEntitys/'
+
pcode
)
}
}
}
</
script
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论