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 个修改的文件
包含
1685 行增加
和
0 行删除
+1685
-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
+681
-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
+252
-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
package
io
.
dataease
.
base
.
domain
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
AreaMappingExample
{
protected
String
orderByClause
;
protected
boolean
distinct
;
protected
List
<
Criteria
>
oredCriteria
;
public
AreaMappingExample
()
{
oredCriteria
=
new
ArrayList
<
Criteria
>();
}
public
void
setOrderByClause
(
String
orderByClause
)
{
this
.
orderByClause
=
orderByClause
;
}
public
String
getOrderByClause
()
{
return
orderByClause
;
}
public
void
setDistinct
(
boolean
distinct
)
{
this
.
distinct
=
distinct
;
}
public
boolean
isDistinct
()
{
return
distinct
;
}
public
List
<
Criteria
>
getOredCriteria
()
{
return
oredCriteria
;
}
public
void
or
(
Criteria
criteria
)
{
oredCriteria
.
add
(
criteria
);
}
public
Criteria
or
()
{
Criteria
criteria
=
createCriteriaInternal
();
oredCriteria
.
add
(
criteria
);
return
criteria
;
}
public
Criteria
createCriteria
()
{
Criteria
criteria
=
createCriteriaInternal
();
if
(
oredCriteria
.
size
()
==
0
)
{
oredCriteria
.
add
(
criteria
);
}
return
criteria
;
}
protected
Criteria
createCriteriaInternal
()
{
Criteria
criteria
=
new
Criteria
();
return
criteria
;
}
public
void
clear
()
{
oredCriteria
.
clear
();
orderByClause
=
null
;
distinct
=
false
;
}
protected
abstract
static
class
GeneratedCriteria
{
protected
List
<
Criterion
>
criteria
;
protected
GeneratedCriteria
()
{
super
();
criteria
=
new
ArrayList
<
Criterion
>();
}
public
boolean
isValid
()
{
return
criteria
.
size
()
>
0
;
}
public
List
<
Criterion
>
getAllCriteria
()
{
return
criteria
;
}
public
List
<
Criterion
>
getCriteria
()
{
return
criteria
;
}
protected
void
addCriterion
(
String
condition
)
{
if
(
condition
==
null
)
{
throw
new
RuntimeException
(
"Value for condition cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
));
}
protected
void
addCriterion
(
String
condition
,
Object
value
,
String
property
)
{
if
(
value
==
null
)
{
throw
new
RuntimeException
(
"Value for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value
));
}
protected
void
addCriterion
(
String
condition
,
Object
value1
,
Object
value2
,
String
property
)
{
if
(
value1
==
null
||
value2
==
null
)
{
throw
new
RuntimeException
(
"Between values for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value1
,
value2
));
}
public
Criteria
andIdIsNull
()
{
addCriterion
(
"id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIsNotNull
()
{
addCriterion
(
"id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdEqualTo
(
Long
value
)
{
addCriterion
(
"id ="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"id <>"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThan
(
Long
value
)
{
addCriterion
(
"id >"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id >="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThan
(
Long
value
)
{
addCriterion
(
"id <"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id <="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id not in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id not between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameIsNull
()
{
addCriterion
(
"province_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameIsNotNull
()
{
addCriterion
(
"province_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameEqualTo
(
String
value
)
{
addCriterion
(
"province_name ="
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameNotEqualTo
(
String
value
)
{
addCriterion
(
"province_name <>"
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameGreaterThan
(
String
value
)
{
addCriterion
(
"province_name >"
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"province_name >="
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameLessThan
(
String
value
)
{
addCriterion
(
"province_name <"
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"province_name <="
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameLike
(
String
value
)
{
addCriterion
(
"province_name like"
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameNotLike
(
String
value
)
{
addCriterion
(
"province_name not like"
,
value
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"province_name in"
,
values
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"province_name not in"
,
values
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"province_name between"
,
value1
,
value2
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"province_name not between"
,
value1
,
value2
,
"provinceName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeIsNull
()
{
addCriterion
(
"province_code is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeIsNotNull
()
{
addCriterion
(
"province_code is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeEqualTo
(
String
value
)
{
addCriterion
(
"province_code ="
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeNotEqualTo
(
String
value
)
{
addCriterion
(
"province_code <>"
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeGreaterThan
(
String
value
)
{
addCriterion
(
"province_code >"
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"province_code >="
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeLessThan
(
String
value
)
{
addCriterion
(
"province_code <"
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"province_code <="
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeLike
(
String
value
)
{
addCriterion
(
"province_code like"
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeNotLike
(
String
value
)
{
addCriterion
(
"province_code not like"
,
value
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeIn
(
List
<
String
>
values
)
{
addCriterion
(
"province_code in"
,
values
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"province_code not in"
,
values
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"province_code between"
,
value1
,
value2
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andProvinceCodeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"province_code not between"
,
value1
,
value2
,
"provinceCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameIsNull
()
{
addCriterion
(
"city_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameIsNotNull
()
{
addCriterion
(
"city_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameEqualTo
(
String
value
)
{
addCriterion
(
"city_name ="
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameNotEqualTo
(
String
value
)
{
addCriterion
(
"city_name <>"
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameGreaterThan
(
String
value
)
{
addCriterion
(
"city_name >"
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"city_name >="
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameLessThan
(
String
value
)
{
addCriterion
(
"city_name <"
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"city_name <="
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameLike
(
String
value
)
{
addCriterion
(
"city_name like"
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameNotLike
(
String
value
)
{
addCriterion
(
"city_name not like"
,
value
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"city_name in"
,
values
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"city_name not in"
,
values
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"city_name between"
,
value1
,
value2
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"city_name not between"
,
value1
,
value2
,
"cityName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeIsNull
()
{
addCriterion
(
"city_code is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeIsNotNull
()
{
addCriterion
(
"city_code is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeEqualTo
(
String
value
)
{
addCriterion
(
"city_code ="
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeNotEqualTo
(
String
value
)
{
addCriterion
(
"city_code <>"
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeGreaterThan
(
String
value
)
{
addCriterion
(
"city_code >"
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"city_code >="
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeLessThan
(
String
value
)
{
addCriterion
(
"city_code <"
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"city_code <="
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeLike
(
String
value
)
{
addCriterion
(
"city_code like"
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeNotLike
(
String
value
)
{
addCriterion
(
"city_code not like"
,
value
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeIn
(
List
<
String
>
values
)
{
addCriterion
(
"city_code in"
,
values
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"city_code not in"
,
values
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"city_code between"
,
value1
,
value2
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCityCodeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"city_code not between"
,
value1
,
value2
,
"cityCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameIsNull
()
{
addCriterion
(
"county_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameIsNotNull
()
{
addCriterion
(
"county_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameEqualTo
(
String
value
)
{
addCriterion
(
"county_name ="
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameNotEqualTo
(
String
value
)
{
addCriterion
(
"county_name <>"
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameGreaterThan
(
String
value
)
{
addCriterion
(
"county_name >"
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"county_name >="
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameLessThan
(
String
value
)
{
addCriterion
(
"county_name <"
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"county_name <="
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameLike
(
String
value
)
{
addCriterion
(
"county_name like"
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameNotLike
(
String
value
)
{
addCriterion
(
"county_name not like"
,
value
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"county_name in"
,
values
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"county_name not in"
,
values
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"county_name between"
,
value1
,
value2
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"county_name not between"
,
value1
,
value2
,
"countyName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeIsNull
()
{
addCriterion
(
"county_code is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeIsNotNull
()
{
addCriterion
(
"county_code is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeEqualTo
(
String
value
)
{
addCriterion
(
"county_code ="
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeNotEqualTo
(
String
value
)
{
addCriterion
(
"county_code <>"
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeGreaterThan
(
String
value
)
{
addCriterion
(
"county_code >"
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"county_code >="
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeLessThan
(
String
value
)
{
addCriterion
(
"county_code <"
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"county_code <="
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeLike
(
String
value
)
{
addCriterion
(
"county_code like"
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeNotLike
(
String
value
)
{
addCriterion
(
"county_code not like"
,
value
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeIn
(
List
<
String
>
values
)
{
addCriterion
(
"county_code in"
,
values
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"county_code not in"
,
values
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"county_code between"
,
value1
,
value2
,
"countyCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCountyCodeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"county_code not between"
,
value1
,
value2
,
"countyCode"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
protected
Criteria
()
{
super
();
}
}
public
static
class
Criterion
{
private
String
condition
;
private
Object
value
;
private
Object
secondValue
;
private
boolean
noValue
;
private
boolean
singleValue
;
private
boolean
betweenValue
;
private
boolean
listValue
;
private
String
typeHandler
;
public
String
getCondition
()
{
return
condition
;
}
public
Object
getValue
()
{
return
value
;
}
public
Object
getSecondValue
()
{
return
secondValue
;
}
public
boolean
isNoValue
()
{
return
noValue
;
}
public
boolean
isSingleValue
()
{
return
singleValue
;
}
public
boolean
isBetweenValue
()
{
return
betweenValue
;
}
public
boolean
isListValue
()
{
return
listValue
;
}
public
String
getTypeHandler
()
{
return
typeHandler
;
}
protected
Criterion
(
String
condition
)
{
super
();
this
.
condition
=
condition
;
this
.
typeHandler
=
null
;
this
.
noValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
typeHandler
=
typeHandler
;
if
(
value
instanceof
List
<?>)
{
this
.
listValue
=
true
;
}
else
{
this
.
singleValue
=
true
;
}
}
protected
Criterion
(
String
condition
,
Object
value
)
{
this
(
condition
,
value
,
null
);
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
secondValue
=
secondValue
;
this
.
typeHandler
=
typeHandler
;
this
.
betweenValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
)
{
this
(
condition
,
value
,
secondValue
,
null
);
}
}
}
\ No newline at end of file
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
package
io
.
dataease
.
map
.
utils
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.file.FileWriter
;
import
cn.hutool.core.util.StrUtil
;
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.map.dto.entity.*
;
import
io.dataease.map.dto.entity.Properties
;
import
io.dataease.map.dto.response.MapResponse
;
import
io.dataease.map.dto.response.MapResultDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
@Component
public
class
MapUtils
{
private
static
AreaMappingMapper
areaMappingMapper
;
@Autowired
public
void
setAreaMappingMapper
(
AreaMappingMapper
areaMappingMapper
)
{
MapUtils
.
areaMappingMapper
=
areaMappingMapper
;
}
private
static
final
String
path
=
"/opt/dataease/data/行政区划列表2020-03.xlsx"
;
private
static
final
String
featureDir
=
"/opt/dataease/data/feature/"
;
public
static
String
formatCode
(
String
code
)
{
return
code
.
substring
(
3
);
}
/*public static List<Map<String, Object>> readCodeList( ) {
ExcelReader reader = ExcelUtil.getReader(path);
List<Map<String, Object>> maps = reader.readAll();
return maps;
}*/
public
static
List
<
Map
<
String
,
Object
>>
readCodeList
(
)
{
AreaMappingExample
example
=
new
AreaMappingExample
();
List
<
AreaMapping
>
areaMappings
=
areaMappingMapper
.
selectByExample
(
example
);
return
areaMappings
.
stream
().
map
(
mapping
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
mapping
.
getId
());
map
.
put
(
Constants
.
PROVINCE_NAME
,
mapping
.
getProvinceName
());
map
.
put
(
Constants
.
PROVINCE_CODE
,
mapping
.
getProvinceCode
());
map
.
put
(
Constants
.
CITY_NAME
,
mapping
.
getCityName
());
map
.
put
(
Constants
.
CITY_CODE
,
mapping
.
getCityCode
());
map
.
put
(
Constants
.
COUNTY_NAME
,
mapping
.
getCountyName
());
map
.
put
(
Constants
.
COUNTY_CODE
,
mapping
.
getCountyCode
());
return
map
;
}).
collect
(
Collectors
.
toList
());
}
public
static
List
<
AreaEntity
>
readAreaEntity
()
{
List
<
Map
<
String
,
Object
>>
maps
=
readCodeList
();
// AreaEntity root = new AreaEntity;
Map
<
String
,
AreaEntity
>
provinceMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
AreaEntity
>
cityMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
AreaEntity
>
countyMap
=
new
ConcurrentHashMap
<>();
AreaEntity
china
=
root
();
maps
.
parallelStream
().
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
();
province_code
=
formatCode
(
province_code
);
city_code
=
formatCode
(
city_code
);
county_code
=
formatCode
(
county_code
);
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
();
provinceMap
.
put
(
province_code
,
child
);
china
.
addChild
(
child
);
}
//当前省
AreaEntity
currentProvince
=
provinceMap
.
get
(
province_code
);
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
);
}
});
// List<AreaEntity> treeNodes = provinceMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List
<
AreaEntity
>
result
=
new
ArrayList
<>();
result
.
add
(
china
);
return
result
;
}
private
static
AreaEntity
root
()
{
return
AreaEntity
.
builder
().
code
(
"100000"
).
name
(
"中华人名共和国"
).
build
();
}
public
static
void
recursionWrite
(
List
<
AreaEntity
>
areaEntityList
)
{
areaEntityList
.
forEach
(
areaEntity
->
{
String
code
=
areaEntity
.
getCode
();
MapResponse
mapResponse
=
HttpUtils
.
get
(
code
);
if
(
StrUtil
.
equals
(
"1"
,
mapResponse
.
getStatus
())
&&
StrUtil
.
equalsAnyIgnoreCase
(
"ok"
,
mapResponse
.
getInfo
())
&&
StrUtil
.
equalsAnyIgnoreCase
(
"10000"
,
mapResponse
.
getInfocode
()))
{
List
<
District
>
districts
=
mapResponse
.
getDistricts
();
if
(
CollectionUtil
.
isNotEmpty
(
districts
))
{
/*District district = districts.get(0);
MapResultDto mapResultDto = buildGeometry(district, areaEntity);
writeFeatureFile(mapResultDto, areaEntity.getCode());*/
List
<
Feature
>
kidFeatures
=
districts
.
stream
().
map
(
district
->
buildFeature
(
district
,
areaEntity
)).
collect
(
Collectors
.
toList
());
MapResultDto
mapResultDto
=
buildGeometry
(
kidFeatures
);
writeFeatureFile
(
mapResultDto
,
areaEntity
.
getCode
());
}
}
if
(
CollectionUtil
.
isNotEmpty
(
areaEntity
.
getChildren
()))
{
recursionWrite
(
areaEntity
.
getChildren
());
}
});
}
public
static
void
recursionWriteFull
(
List
<
AreaEntity
>
areaEntityList
)
{
areaEntityList
.
forEach
(
areaEntity
->
{
List
<
AreaEntity
>
childrens
=
areaEntity
.
getChildren
();
if
(
CollectionUtil
.
isEmpty
(
childrens
))
{
childrens
=
new
ArrayList
<>();
childrens
.
add
(
areaEntity
);
}
List
<
Feature
>
features
=
new
ArrayList
<>();
childrens
.
stream
().
forEach
(
child
->
{
MapResponse
mapResponse
=
HttpUtils
.
get
(
child
.
getCode
());
if
(
StrUtil
.
equals
(
"1"
,
mapResponse
.
getStatus
())
&&
StrUtil
.
equalsAnyIgnoreCase
(
"ok"
,
mapResponse
.
getInfo
())
&&
StrUtil
.
equalsAnyIgnoreCase
(
"10000"
,
mapResponse
.
getInfocode
()))
{
List
<
District
>
districts
=
mapResponse
.
getDistricts
();
if
(
CollectionUtil
.
isNotEmpty
(
districts
))
{
List
<
Feature
>
kidFeatures
=
districts
.
stream
().
map
(
district
->
buildFeature
(
district
,
child
)).
collect
(
Collectors
.
toList
());
features
.
addAll
(
kidFeatures
);
}
}
});
if
(
CollectionUtil
.
isNotEmpty
(
features
))
{
MapResultDto
mapResultDto
=
buildGeometry
(
features
);
writeFeatureFileFull
(
mapResultDto
,
areaEntity
.
getCode
()
+
"_full"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
areaEntity
.
getChildren
()))
{
recursionWriteFull
(
areaEntity
.
getChildren
());
}
});
}
public
static
Feature
buildFeature
(
District
district
,
AreaEntity
areaEntity
)
{
String
type
=
"Feature"
;
Properties
properties
=
new
Properties
();
properties
.
setAdcode
(
district
.
getAdcode
());
properties
.
setName
(
district
.
getName
());
properties
.
setCenter
(
Arrays
.
stream
(
district
.
getCenter
().
split
(
","
)).
map
(
Double:
:
parseDouble
).
collect
(
Collectors
.
toList
()));
properties
.
setCentroid
(
properties
.
getCenter
());
properties
.
setChildrenNum
(
CollectionUtil
.
isNotEmpty
(
areaEntity
.
getChildren
())
?
areaEntity
.
getChildren
().
size
()
:
0
);
properties
.
setLevel
(
district
.
getLevel
());
Parent
parent
=
new
Parent
();
parent
.
setAdcode
(
areaEntity
.
getPcode
());
properties
.
setParent
(
parent
);
String
polylineStr
=
district
.
getPolyline
();
String
[]
polylines
=
polylineStr
.
split
(
"[|]"
);
List
<
List
<
List
<
List
<
Double
>>>>
multiPolygon
=
Arrays
.
stream
(
polylines
).
map
(
polyline
->
{
String
[]
strings
=
polyline
.
split
(
";"
);
List
<
List
<
Double
>>
line
=
Arrays
.
stream
(
strings
).
map
(
str
->
{
String
[]
pointstr
=
str
.
split
(
","
);
List
<
String
>
strPoint
=
Arrays
.
asList
(
pointstr
);
List
<
Double
>
point
=
strPoint
.
stream
().
map
(
Double:
:
parseDouble
).
collect
(
Collectors
.
toList
());
return
point
;
}).
collect
(
Collectors
.
toList
());
List
<
Double
>
firstPoint
=
line
.
get
(
0
);
List
<
Double
>
lastPoint
=
line
.
get
(
line
.
size
()
-
1
);
// 线的起始点和终点没有重合 说明没有闭合 需要手动闭合
if
(
firstPoint
.
get
(
0
)
!=
lastPoint
.
get
(
0
)
||
firstPoint
.
get
(
1
)
!=
lastPoint
.
get
(
1
))
{
line
.
add
(
firstPoint
);
}
List
<
List
<
List
<
Double
>>>
polygon
=
new
ArrayList
<>();
polygon
.
add
(
line
);
return
polygon
;
}).
collect
(
Collectors
.
toList
());
Geometry
geometry
=
new
Geometry
();
geometry
.
setType
(
"MultiPolygon"
);
geometry
.
setCoordinates
(
multiPolygon
);
Feature
feature
=
new
Feature
();
feature
.
setType
(
type
);
feature
.
setProperties
(
properties
);
feature
.
setGeometry
(
geometry
);
return
feature
;
}
/*public static MapResultDto buildGeometry(District district, AreaEntity areaEntity) {
Feature feature = buildFeature(district, areaEntity);
MapResultDto mapResultDto = new MapResultDto();
mapResultDto.setType("FeatureCollection");
List<Feature> features = new ArrayList<>();
features.add(feature);
mapResultDto.setFeatures(features);
return mapResultDto;
}*/
public
static
MapResultDto
buildGeometry
(
List
<
Feature
>
features
)
{
MapResultDto
mapResultDto
=
new
MapResultDto
();
mapResultDto
.
setType
(
"FeatureCollection"
);
mapResultDto
.
setFeatures
(
features
);
return
mapResultDto
;
}
public
static
void
writeFeatureFile
(
MapResultDto
mapResultDto
,
String
fileName
)
{
String
path
=
featureDir
+
fileName
+
".json"
;
FileWriter
fileWriter
=
new
FileWriter
(
path
);
String
content
=
JSONUtil
.
toJsonStr
(
mapResultDto
);
fileWriter
.
write
(
content
);
}
public
static
void
writeFeatureFileFull
(
MapResultDto
mapResultDto
,
String
fileName
)
{
String
path
=
featureDir
+
"full/"
+
fileName
+
".json"
;
FileWriter
fileWriter
=
new
FileWriter
(
path
);
String
content
=
JSONUtil
.
toJsonStr
(
mapResultDto
);
fileWriter
.
write
(
content
);
}
}
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论