开发区围栏
This commit is contained in:
+183
@@ -0,0 +1,183 @@
|
||||
package com.fangjia.bkoff.controllers;
|
||||
|
||||
import com.fangjia.bkoff.model.DevelopmentZoneModel;
|
||||
import com.fangjia.bkoff.model.JsonModel;
|
||||
import com.fangjia.bkoff.model.LatlngPolygonModel;
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.LatlngPolygon;
|
||||
import com.fangjia.dal.mongo.model.StatsIndex;
|
||||
import com.fangjia.service.mongo.fangjia.DevelopmentZoneService;
|
||||
import com.fangjia.service.mongo.fangjia.LatlngPolygonService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.fangjia.core.util.GeoUtils.LAT;
|
||||
import static com.fangjia.core.util.GeoUtils.LNG;
|
||||
|
||||
/**
|
||||
* Created by dxy on 2015/6/8.
|
||||
*/
|
||||
public class DevelopmentZoneController {
|
||||
private DevelopmentZoneService developmentZoneService;
|
||||
|
||||
public Object listAction(DevelopmentZoneModel model) {
|
||||
Pager pager = model.getPager(30);
|
||||
if (pager.getCurrentPage() > 100) {
|
||||
pager.setCurrentPage(1);
|
||||
}
|
||||
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getName(), pager);
|
||||
model.setDevelopmentZoneList(developmentZones);
|
||||
model.setPager(pager);
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object showAction(DevelopmentZoneModel model) {
|
||||
if (model.getId() == null) {
|
||||
return model;
|
||||
}
|
||||
|
||||
model.setDevelopmentZone(developmentZoneService.findDevelopmentZone(model.getId()));
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object editAction(DevelopmentZoneModel model) {
|
||||
if (model.getId() == null) {
|
||||
return model;
|
||||
}
|
||||
|
||||
model.setDevelopmentZone(developmentZoneService.findDevelopmentZone(model.getId()));
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object deleteAction(LatlngPolygonModel model) {
|
||||
JsonModel ret = new JsonModel();
|
||||
if (model.getId() == null) {
|
||||
return ret;
|
||||
}
|
||||
developmentZoneService.deleteDevelopmentZone(model.getId());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Object saveOrUpdateAction(DevelopmentZoneModel model) {
|
||||
JsonModel ret = new JsonModel();
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
ret.setJsonModel(data);
|
||||
// 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", "保存失败");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (model.getId() == null) {
|
||||
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);
|
||||
}
|
||||
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.setAddress(StringUtils.isBlank(model.getAddress()) ? "" : model.getAddress());
|
||||
entity.setArea(StringUtils.isBlank(model.getArea()) ? "" : model.getArea());
|
||||
entity.setBlock(StringUtils.isBlank(model.getBlock()) ? "" : model.getBlock());
|
||||
entity.setBuildDate(StringUtils.isBlank(model.getBuildDate()) ? "" : model.getBuildDate());
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setIndustry(StringUtils.isBlank(model.getIndustry()) ? "" : model.getIndustry());
|
||||
entity.setNameEn(StringUtils.isBlank(model.getNameEn()) ? "" : model.getNameEn());
|
||||
entity.setType(StringUtils.isBlank(model.getType()) ? "" : model.getType());
|
||||
entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl());
|
||||
developmentZoneService.saveDevelopmentZone(entity);
|
||||
data.put("msg", "保存成功");
|
||||
} else {
|
||||
DevelopmentZone entity = developmentZoneService.findDevelopmentZone(model.getId());
|
||||
// Map<String, Object> udata = new HashMap<String, Object>();
|
||||
|
||||
// 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);
|
||||
}
|
||||
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.setAddress(StringUtils.isBlank(model.getAddress()) ? "" : model.getAddress());
|
||||
entity.setArea(StringUtils.isBlank(model.getArea()) ? "" : model.getArea());
|
||||
entity.setBlock(StringUtils.isBlank(model.getBlock()) ? "" : model.getBlock());
|
||||
entity.setBuildDate(StringUtils.isBlank(model.getBuildDate()) ? "" : model.getBuildDate());
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setIndustry(StringUtils.isBlank(model.getIndustry()) ? "" : model.getIndustry());
|
||||
entity.setNameEn(StringUtils.isBlank(model.getNameEn()) ? "" : model.getNameEn());
|
||||
entity.setType(StringUtils.isBlank(model.getType()) ? "" : model.getType());
|
||||
entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl());
|
||||
developmentZoneService.updateDevelopmentZone(entity);
|
||||
data.put("msg", "保存成功");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public void setDevelopmentZoneService(DevelopmentZoneService developmentZoneService) {
|
||||
this.developmentZoneService = developmentZoneService;
|
||||
}
|
||||
//将百度坐标转为高德坐标
|
||||
|
||||
public List<List<Double>> convertGeoList(List<List<Double>> bdLocationList) {
|
||||
List<List<Double>> gdLocationList = new ArrayList<List<Double>>();
|
||||
|
||||
// 使用增强的 for 循环遍历列表
|
||||
for (List<Double> bdLocation : bdLocationList) {
|
||||
List<Double> gdLocation = new ArrayList<Double>();
|
||||
// 将百度坐标转为高德坐标
|
||||
Map<String, Double> map = GeoUtils.bd09ToGcj02(bdLocation.get(0), bdLocation.get(1));
|
||||
gdLocation.add(map.get(LAT));
|
||||
gdLocation.add(map.get(LNG));
|
||||
gdLocationList.add(gdLocation);
|
||||
}
|
||||
return gdLocationList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
package com.fangjia.bkoff.model;
|
||||
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.LatlngPolygon;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DevelopmentZoneModel extends BaseModel {
|
||||
private String id;
|
||||
private String address;
|
||||
private String buildDate;
|
||||
private Date createTime;
|
||||
private String industry;
|
||||
private String area;
|
||||
|
||||
private String level;
|
||||
private String name;
|
||||
private String nameEn;
|
||||
private String province;
|
||||
private String type;
|
||||
private String url;
|
||||
|
||||
List<List<Double>> shape;
|
||||
List<List<Double>> bdShape;
|
||||
|
||||
|
||||
private String block;
|
||||
|
||||
private DevelopmentZone developmentZone;
|
||||
private List<DevelopmentZone> developmentZoneList;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getBuildDate() {
|
||||
return buildDate;
|
||||
}
|
||||
|
||||
public void setBuildDate(String buildDate) {
|
||||
this.buildDate = buildDate;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(String industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNameEn() {
|
||||
return nameEn;
|
||||
}
|
||||
|
||||
public void setNameEn(String nameEn) {
|
||||
this.nameEn = nameEn;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public List<List<Double>> getShape() {
|
||||
return shape;
|
||||
}
|
||||
|
||||
public void setShape(List<List<Double>> shape) {
|
||||
this.shape = shape;
|
||||
}
|
||||
|
||||
public List<List<Double>> getBdShape() {
|
||||
return bdShape;
|
||||
}
|
||||
|
||||
public void setBdShape(List<List<Double>> bdShape) {
|
||||
this.bdShape = bdShape;
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public DevelopmentZone getDevelopmentZone() {
|
||||
return developmentZone;
|
||||
}
|
||||
|
||||
public void setDevelopmentZone(DevelopmentZone developmentZone) {
|
||||
this.developmentZone = developmentZone;
|
||||
}
|
||||
|
||||
public List<DevelopmentZone> getDevelopmentZoneList() {
|
||||
return developmentZoneList;
|
||||
}
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
public void setDevelopmentZoneList(List<DevelopmentZone> developmentZoneList) {
|
||||
this.developmentZoneList = developmentZoneList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<#if latlngPolygon??>
|
||||
<@d_city defaultValue="${latlngPolygon.city!}" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
<#else>
|
||||
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
</#if>
|
||||
</td>
|
||||
<td>
|
||||
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" value="<#if developmentZone??>${developmentZone.name!}</#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" value="<#if developmentZone??>${developmentZone.province!}</#if>"/>
|
||||
<label for="level">级别:</label> <input id="level" name="level" type="text" 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="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="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>"/>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input name="bdShape" id="bdShape" type="hidden"/>
|
||||
<div id="allmap" style="width:100%;height:900px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css" />
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
if($("#cityDisplay").val()) {
|
||||
map.centerAndZoom($("#cityDisplay").val(), 13);
|
||||
}else {
|
||||
map.centerAndZoom('上海', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
function changeCity(display){
|
||||
clearAll();
|
||||
map.centerAndZoom(display, 13);
|
||||
}
|
||||
|
||||
var overlays = [];
|
||||
var overlaycomplete = function(e){
|
||||
overlays.push(e.overlay);
|
||||
var points = e.overlay.getPath();
|
||||
|
||||
var bdShape = [];
|
||||
for(var i=0;i<points.length;i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng );
|
||||
location.push(points[i].lat );
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
};
|
||||
|
||||
var styleOptions = {
|
||||
strokeColor:"red", //边线颜色。
|
||||
fillColor:"red", //填充颜色。当参数为空时,圆形将没有填充效果。
|
||||
strokeWeight: 3, //边线的宽度,以像素为单位。
|
||||
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
|
||||
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
|
||||
strokeStyle: 'solid' //边线的样式,solid或dashed。
|
||||
}
|
||||
//实例化鼠标绘制工具
|
||||
var drawingManager = new BMapLib.DrawingManager(map, {
|
||||
isOpen: false, //是否开启绘制模式
|
||||
enableDrawingTool: true, //是否显示工具栏
|
||||
drawingToolOptions: {
|
||||
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
|
||||
offset: new BMap.Size(5, 5), //偏离值
|
||||
},
|
||||
circleOptions: styleOptions, //圆的样式
|
||||
polylineOptions: styleOptions, //线的样式
|
||||
polygonOptions: styleOptions, //多边形的样式
|
||||
rectangleOptions: styleOptions //矩形的样式
|
||||
});
|
||||
//添加鼠标绘制工具监听事件,用于获取绘制结果
|
||||
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
|
||||
function clearAll() {
|
||||
for(var i = 0; i < overlays.length; i++){
|
||||
map.removeOverlay(overlays[i]);
|
||||
}
|
||||
overlays.length = 0;
|
||||
}
|
||||
|
||||
$("#saveOrUpdate").click(function(){
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
location.href="list";
|
||||
},
|
||||
error : function() {
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,86 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/edit" target="_blank" class="list">新增开发区围栏</a>
|
||||
</div>
|
||||
<form action="../developmentZone/list" id="_search_log_form">
|
||||
<div>
|
||||
<label for="province">省份:</label>
|
||||
<input type="text" name="province" id="province" class="input-medium" style="margin-top:9px;"
|
||||
value="${province!}"></input>
|
||||
<label for="name">名称:</label>
|
||||
<input type="text" name="name" id="name" class="input-medium" style="margin-top:9px;"
|
||||
value="${name!}"></input>
|
||||
|
||||
<input id="queryBtn" class="btn btn-primary" type="submit" value="查询"/>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<div class="list" style="margin-top:5px;">
|
||||
<table style="float:left;" name="reginTable" class="regionTab">
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>级别</th>
|
||||
<th>省份</th>
|
||||
<th style="width: 160px">建立时间</th>
|
||||
<th style="width: 120px;">操作</th>
|
||||
</tr>
|
||||
<#list developmentZoneList as it>
|
||||
<tr>
|
||||
<td>${it.name!}</td>
|
||||
<td>${it.level!}</td>
|
||||
<td>${it.province!}</td>
|
||||
<td>
|
||||
${it.buildDate}
|
||||
</td>
|
||||
<td>
|
||||
<a href="show?id=${it.id!}" target="_blank">查看</a>
|
||||
<a href="../developmentZone/edit?id=${it.id!}" target="_blank">新建围栏</a>
|
||||
<a name="del${it_index}" href="javascript:;" ref="delete?id=${it.id!}">删除</a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</#list>
|
||||
</table>
|
||||
<#if pager??>
|
||||
<@d_pager controller="developmentZone" action="list" currentPage=pager.currentPage totalPages=pager.totalPages theme="full"/>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<script type="application/javascript">
|
||||
$("a[name^='del']").click(function () {
|
||||
if (!confirm('确认删除?')) {
|
||||
return false;
|
||||
}
|
||||
var href = $(this).attr("ref");
|
||||
jQuery.ajax({
|
||||
type: 'get',
|
||||
url: href,
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function (data) {
|
||||
location.reload();
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,87 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
<table>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>省份</td>
|
||||
<td>${developmentZone.province!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>级别</td>
|
||||
<td>${developmentZone.level!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>名称</td>
|
||||
<td>${developmentZone.name!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>区块</td>
|
||||
<td>${developmentZone.block!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div id="allmap" style="width:1024px;height:600px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="http://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript"
|
||||
src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"/>
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript"
|
||||
src="http://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
<#if developmentZone.bdShape??>
|
||||
var polygon = new BMap.Polygon([
|
||||
<#list developmentZone.bdShape.coordinates as latlng>
|
||||
new BMap.Point(${latlng[0]}, ${latlng[1]})<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>
|
||||
</#list>
|
||||
], {strokeColor: "blue", strokeWeight: 2, strokeOpacity: 0.5});
|
||||
</#if>
|
||||
|
||||
|
||||
map.centerAndZoom(polygon.getBounds().getCenter(), 13);
|
||||
map.addOverlay(polygon); //增加多边形
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -48,6 +48,7 @@
|
||||
<@menuitem uri='/developer/list' text="开发商" />
|
||||
<@menuitem uri='/agentMaster/listMaster' text="中介公司" />
|
||||
<@menuitem uri='/mortgageInfo/list' text="抵押品" />
|
||||
<@menuitem uri='/developmentZone/list' text="开发区" />
|
||||
</ul>
|
||||
</li>
|
||||
<li class="menu">
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.LatlngPolygon;
|
||||
|
||||
public interface DevelopmentZoneDao extends MongoDao<DevelopmentZone> {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.LatlngPolygon;
|
||||
|
||||
public class DevelopmentZoneDaoImpl extends MongoDaoImpl<DevelopmentZone> implements DevelopmentZoneDao {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia_base.development_zone")
|
||||
public class DevelopmentZone implements MongoEntity {
|
||||
|
||||
private String id;
|
||||
private String address;
|
||||
private String buildDate;
|
||||
private Date createTime;
|
||||
private String industry;
|
||||
private String area;
|
||||
|
||||
private String level;
|
||||
private String name;
|
||||
private String nameEn;
|
||||
private String province;
|
||||
private String type;
|
||||
private String url;
|
||||
// ¸ßµÂ¾Î³¶È
|
||||
private Map<String, Object> shape;
|
||||
// °Ù¶È¾Î³¶È
|
||||
private Map<String, Object> bdShape;
|
||||
|
||||
private String block;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "address")
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Column(name = "build_date")
|
||||
public String getBuildDate() {
|
||||
return buildDate;
|
||||
}
|
||||
|
||||
public void setBuildDate(String buildDate) {
|
||||
this.buildDate = buildDate;
|
||||
}
|
||||
|
||||
@Column(name = "create_time")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Column(name = "industry")
|
||||
public String getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(String industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
@Column(name = "level")
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Column(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "name_en")
|
||||
public String getNameEn() {
|
||||
return nameEn;
|
||||
}
|
||||
|
||||
public void setNameEn(String nameEn) {
|
||||
this.nameEn = nameEn;
|
||||
}
|
||||
|
||||
@Column(name = "province")
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Column(name = "url")
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "shape")
|
||||
public Map<String, Object> getShape() {
|
||||
return shape;
|
||||
}
|
||||
|
||||
public void setShape(Map<String, Object> shape) {
|
||||
this.shape = shape;
|
||||
}
|
||||
|
||||
@Column(name = "bd_shape")
|
||||
public Map<String, Object> getBdShape() {
|
||||
return bdShape;
|
||||
}
|
||||
|
||||
public void setBdShape(Map<String, Object> bdShape) {
|
||||
this.bdShape = bdShape;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "area")
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
@Column(name = "block")
|
||||
public String getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public void setBlock(String block) {
|
||||
this.block = block;
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by dxy on 2015/6/8.
|
||||
*/
|
||||
public interface DevelopmentZoneService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param developmentZone
|
||||
*/
|
||||
public void saveDevelopmentZone(DevelopmentZone developmentZone);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void deleteDevelopmentZone(String id);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param id
|
||||
* @param udata
|
||||
*/
|
||||
public void updateDevelopmentZone(DevelopmentZone developmentZone);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public DevelopmentZone findDevelopmentZone(String id);
|
||||
|
||||
/**
|
||||
* 分页查找
|
||||
*
|
||||
* @param province
|
||||
* @param name
|
||||
* @param pager
|
||||
* @return
|
||||
*/
|
||||
public List<DevelopmentZone> findDevelopmentZone(String province,String name, Pager pager);
|
||||
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.mongo.dao.DevelopmentZoneDao;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import com.fangjia.dal.mongo.model.DevelopmentZone;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DevelopmentZoneServiceImpl implements DevelopmentZoneService {
|
||||
private DevelopmentZoneDao developmentZoneDao;
|
||||
|
||||
|
||||
@Override
|
||||
public void saveDevelopmentZone(DevelopmentZone DevelopmentZone) {
|
||||
developmentZoneDao.save(DevelopmentZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDevelopmentZone(String id) {
|
||||
developmentZoneDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDevelopmentZone(DevelopmentZone developmentZone) {
|
||||
developmentZoneDao.update(developmentZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevelopmentZone findDevelopmentZone(String id) {
|
||||
return developmentZoneDao.findById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DevelopmentZone> findDevelopmentZone(String province, String name, Pager pager) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
if (StringUtils.isNotBlank(province)) {
|
||||
params.add(new QueryParam("province", province));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
params.add(new QueryParam("name", name));
|
||||
}
|
||||
|
||||
return developmentZoneDao.findAllByParams(params, pager.getStartRow(), pager.getPageSize());
|
||||
}
|
||||
|
||||
|
||||
public void setDevelopmentZoneDao(DevelopmentZoneDao developmentZoneDao) {
|
||||
this.developmentZoneDao = developmentZoneDao;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user