forked from github/dataease
feat: 添加测试地图
This commit is contained in:
parent
8d144a4868
commit
84808a6e96
@ -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>
|
||||
|
@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,680 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
@ -0,0 +1,243 @@
|
||||
<?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>
|
21
backend/src/main/java/io/dataease/map/api/MapApi.java
Normal file
21
backend/src/main/java/io/dataease/map/api/MapApi.java
Normal file
@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
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";
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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;
|
||||
|
||||
}
|
11
backend/src/main/java/io/dataease/map/dto/entity/Parent.java
Normal file
11
backend/src/main/java/io/dataease/map/dto/entity/Parent.java
Normal file
@ -0,0 +1,11 @@
|
||||
package io.dataease.map.dto.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class Parent implements Serializable {
|
||||
|
||||
private String adcode;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
50
backend/src/main/java/io/dataease/map/server/MapServer.java
Normal file
50
backend/src/main/java/io/dataease/map/server/MapServer.java
Normal file
@ -0,0 +1,50 @@
|
||||
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());*/
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
40
backend/src/main/java/io/dataease/map/utils/HttpUtils.java
Normal file
40
backend/src/main/java/io/dataease/map/utils/HttpUtils.java
Normal file
@ -0,0 +1,40 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
252
backend/src/main/java/io/dataease/map/utils/MapUtils.java
Normal file
252
backend/src/main/java/io/dataease/map/utils/MapUtils.java
Normal file
@ -0,0 +1,252 @@
|
||||
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);
|
||||
}
|
||||
}
|
2938
backend/src/main/resources/db/migration/V14__area_code.sql
Normal file
2938
backend/src/main/resources/db/migration/V14__area_code.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -128,5 +128,15 @@
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
|
||||
<!--消息类型缓存-->
|
||||
<cache
|
||||
name="sys_map_areas"
|
||||
eternal="true"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="3000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="false"
|
||||
/>
|
||||
|
||||
|
||||
</ehcache>
|
71
frontend/src/views/system/map/index.vue
Normal file
71
frontend/src/views/system/map/index.vue
Normal file
@ -0,0 +1,71 @@
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user