开发区增加城市区域

This commit is contained in:
mjt
2024-05-16 17:07:25 +08:00
parent 4f159d7dd8
commit 32bedead65
7 changed files with 61 additions and 35 deletions
@@ -33,9 +33,9 @@ public class DevelopmentZoneController {
if (pager.getCurrentPage() > 100) {
pager.setCurrentPage(1);
}
long countDev = developmentZoneService.countDev(model.getProvince(), model.getName(), model.getLevel());
long countDev = developmentZoneService.countDev(model.getProvince(),model.getName(), model.getLevel());
pager.setTotalRows((int) countDev);
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getName(), model.getLevel(), pager);
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(),model.getName(), model.getLevel(), pager);
model.setDevelopmentZoneList(developmentZones);
model.setPager(pager);
return model;
@@ -76,38 +76,41 @@ public class DevelopmentZoneController {
ret.setJsonModel(data);
if (model.getId() == null) {
// name province bdLocation level 不能为空
if (StringUtils.isBlank(model.getProvince()) || StringUtils.isBlank(model.getName()) || model.getBdShape() == null || model.getBdShape().toString().equals("[]") || StringUtils.isBlank(model.getLevel())) {
data.put("msg", "保存失败(开发区名称,所在省份,级别,围栏不能为空)");
if (StringUtils.isBlank(model.getProvince()) || StringUtils.isBlank(model.getName()) || StringUtils.isBlank(model.getLevel())) {
data.put("msg", "保存失败(开发区名称,所在省份,级别不能为空)");
return ret;
}
DevelopmentZone entity = new DevelopmentZone();
// name province bdLocation level 不能为空/
entity.setName(model.getName());
entity.setProvince(model.getProvince());
String locationStr = model.getBdShape().toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(" ", "");
List<List<Double>> bdLocationList = new ArrayList<List<Double>>();
String[] splitStr = locationStr.split(";");
for (int i = 0; i < splitStr.length; i++) {
String[] splitStr2 = splitStr[i].split(",");
List<Double> location = new ArrayList<Double>();
location.add(Double.parseDouble(splitStr2[0]));
location.add(Double.parseDouble(splitStr2[1]));
bdLocationList.add(location);
// 新加开发区,围栏不是必须有的
if (model.getBdShape() != null && !model.getBdShape().toString().equals("[]")) {
String locationStr = model.getBdShape().toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(" ", "");
List<List<Double>> bdLocationList = new ArrayList<List<Double>>();
String[] splitStr = locationStr.split(";");
for (int i = 0; i < splitStr.length; i++) {
String[] splitStr2 = splitStr[i].split(",");
List<Double> location = new ArrayList<Double>();
location.add(Double.parseDouble(splitStr2[0]));
location.add(Double.parseDouble(splitStr2[1]));
bdLocationList.add(location);
}
//加上第一个,形成首尾闭合
bdLocationList.add(bdLocationList.get(0));
model.setBdShape(bdLocationList);
// 百度经纬度
Map<String, Object> bdShape = new HashMap<String, Object>();
bdShape.put("type", "polygon");
bdShape.put("coordinates", model.getBdShape());
entity.setBdShape(bdShape);
// 高德经纬度
Map<String, Object> shape = new HashMap<String, Object>();
shape.put("type", "polygon");
Object coordinates = convertGeoList(model.getBdShape());
shape.put("coordinates", coordinates);
entity.setShape(shape);
}
//加上第一个,形成首尾闭合
bdLocationList.add(bdLocationList.get(0));
model.setBdShape(bdLocationList);
// 百度经纬度
Map<String, Object> bdShape = new HashMap<String, Object>();
bdShape.put("type", "polygon");
bdShape.put("coordinates", model.getBdShape());
entity.setBdShape(bdShape);
// 高德经纬度
Map<String, Object> shape = new HashMap<String, Object>();
shape.put("type", "polygon");
Object coordinates = convertGeoList(model.getBdShape());
shape.put("coordinates", coordinates);
entity.setShape(shape);
entity.setLevel(model.getLevel());
entity.setAlias(model.getAlias());
@@ -31,6 +31,7 @@ public class DevelopmentZoneModel extends BaseModel {
private String province;
private String type;
private String url;
private String district;
List<List<Double>> shape;
List<List<Double>> bdShape;
@@ -41,6 +42,14 @@ public class DevelopmentZoneModel extends BaseModel {
private DevelopmentZone developmentZone;
private List<DevelopmentZone> developmentZoneList;
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getId() {
return id;
}
@@ -9,7 +9,7 @@
<div class="city-border">
<div class="city-border-left hide" id="city-border-left"></div>
<div id="city-border-mid" class="">
<a title="选择城市" class="city-current" id="wt-city-title"><#if defaultValue?? && defaultValue != ''>${cityDisplayMap[defaultValue]}<#elseif showClear>无<#elseif showAll>全部<#else>选择城市</#if></a>
<a title="选择城市" class="city-current" id="wt-city-title"><#if defaultValue?? && defaultValue != '' &&cityDisplayMap[defaultValue]??>${cityDisplayMap[defaultValue]}<#elseif showClear>无<#elseif showAll>全部<#else>选择城市</#if></a>
<span class="downtip" id="wt-city-other"></span>
</div>
<div class="city-border-right hide" id="city-border-right"></div>
@@ -33,20 +33,22 @@
</td>
<td>
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
<label for="name">别名:</label> <input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??>${developmentZone.alias!}</#if>"/>
<label for="alias">别名:</label> <input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??>${developmentZone.alias!}</#if>"/>
<label for="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text" value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
<label for="province">所在省份:</label> <input id="province" name="province" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.province!}</#if>"/>
<label for="province">所在省份:</label> <input id="province" name="province" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.province!}</#if>"/><br>
<label for="cityName">城市:</label><input id="cityName" name="cityName" type="text" value="<#if developmentZone??>${developmentZone.cityName!}</#if>"/>
<label for="district">区域:</label><input id="district" name="district" type="text" value="<#if developmentZone??>${developmentZone.district!}</#if>"/>
<label for="level">级别:</label> <input id="level" name="level" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
<label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/>
<label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
<label for="area">所在地区:</label> <input id="area" name="area" type="text" value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
<label for="type">类型:</label><input id="type" name="type" type="text" value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
<label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/>
<label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
<label for="industry">主导产业:</label><input id="industry" name="industry" type="text" value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
<label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/>
<label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
<input id="saveOrUpdate" type="button" value="提交"/>
</td>
</tr>
<tr>
<td colspan="2">
@@ -14,7 +14,7 @@
<#include "/layout/header.ftl" />
<div class="main-content">
<div class="menuButton">
<a href="../developmentZone/edit" target="_blank" class="list">新增开发区围栏</a>&nbsp;&nbsp;
<a href="../developmentZone/edit" target="_blank" class="list">新增开发区</a>&nbsp;&nbsp;
</div>
<form action="../developmentZone/list" id="_search_log_form">
<div>
@@ -40,6 +40,8 @@
<th>别名</th>
<th>开发区级别</th>
<th>省份</th>
<th>城市</th>
<th>区域</th>
<th>区块</th>
<th>是否有围栏</th>
<th>操作人员</th>
@@ -52,6 +54,8 @@
<td>${it.alias!}</td>
<td>${it.level!}</td>
<td>${it.province!}</td>
<td>${it.cityName!}</td>
<td>${it.district!}</td>
<td>${it.block!}</td>
<td>
<#if it.bdShape?has_content>
@@ -31,6 +31,14 @@
<td>省份</td>
<td>${developmentZone.province!}</td>
</tr>
<tr>
<td>城市</td>
<td>${developmentZone.cityName!}</td>
</tr>
<tr>
<td>区域</td>
<td>${developmentZone.district!}</td>
</tr>
<tr>
<td>级别</td>
<td>${developmentZone.level!}</td>
@@ -38,7 +38,7 @@ public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
@Override
public List<DevelopmentZone> findDevelopmentZone(String province, String name,String level, Pager pager) {
public List<DevelopmentZone> findDevelopmentZone(String province,String name,String level, Pager pager) {
List<QueryParam> params = new ArrayList<QueryParam>();
if (StringUtils.isNotBlank(province)) {
Pattern pattern = Pattern.compile(".*" + province + ".*");