处理网格绘制问题
This commit is contained in:
parent
b8fb98eaaa
commit
e2040cd2ca
@ -71,9 +71,8 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
Map<String, Object> params = HashMapUtil.beanToMap(gridVO);
|
Map<String, Object> params = HashMapUtil.beanToMap(gridVO);
|
||||||
params.put("gridSquare", getSquare(pointArray));
|
params.put("gridSquare", getSquare(pointArray));
|
||||||
params.put("fillColor", gridVO.getGrid().getFillColor());
|
params.put("fillColor", gridVO.getGrid().getFillColor());
|
||||||
GridPO areaLastPO = getAreaLastPO(gridVO.getAreaCode());
|
String gridCode = getSaveGridCode(gridVO.getAreaCode());
|
||||||
String areaCode = areaLastPO == null ? String.format("%s001", gridVO.getAreaCode().substring(0, 12)) : String.valueOf(Long.valueOf(areaLastPO.getGridCode()) + 1);
|
params.put("gridCode", gridCode);
|
||||||
params.put("gridCode", areaCode);
|
|
||||||
params.put("gridId", gridId);
|
params.put("gridId", gridId);
|
||||||
params.remove("relationIdArray");
|
params.remove("relationIdArray");
|
||||||
params.remove("pointArray");
|
params.remove("pointArray");
|
||||||
@ -84,7 +83,7 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
gridRelationService.save(gridId, relationIdArray);
|
gridRelationService.save(gridId, relationIdArray);
|
||||||
gridPointService.save(gridId, pointArray);
|
gridPointService.save(gridId, pointArray);
|
||||||
if (gridSaveAfterHandler != null) {
|
if (gridSaveAfterHandler != null) {
|
||||||
gridSaveAfterHandler.handle(gridId, areaCode, gridVO.getGridName(), gridVO.getGrid().getFillColor(), gridVO.getAreaCode(), gridVO.getAreaName());
|
gridSaveAfterHandler.handle(gridId, gridCode, gridVO.getGridName(), gridVO.getGrid().getFillColor(), gridVO.getAreaCode(), gridVO.getAreaName());
|
||||||
}
|
}
|
||||||
return gridId;
|
return gridId;
|
||||||
}
|
}
|
||||||
@ -164,10 +163,18 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(String gridId, GridVO gridVO) throws Exception {
|
public void update(String gridId, GridVO gridVO) throws Exception {
|
||||||
|
GridDTO gridDTO = get(gridId);
|
||||||
|
if (gridDTO == null) {
|
||||||
|
throw new SearchException("网格不存在");
|
||||||
|
}
|
||||||
GridVO.Grid grid = gridVO.getGrid();
|
GridVO.Grid grid = gridVO.getGrid();
|
||||||
Map<String, Object> params = HashMapUtil.beanToMap(gridVO);
|
Map<String, Object> params = HashMapUtil.beanToMap(gridVO);
|
||||||
params.put("fillColor", gridVO.getGrid().getFillColor());
|
params.put("fillColor", gridVO.getGrid().getFillColor());
|
||||||
params.put("gridSquare", getSquare(grid.getPointArray()));
|
params.put("gridSquare", getSquare(grid.getPointArray()));
|
||||||
|
if (!StringUtils.equals(gridDTO.getAreaCode(), gridVO.getAreaCode())) {
|
||||||
|
String gridCode = getUpdateGridCode(gridVO.getAreaCode(), gridDTO.getGridCode());
|
||||||
|
params.put("gridCode", gridCode);
|
||||||
|
}
|
||||||
params.put("gridId", gridId);
|
params.put("gridId", gridId);
|
||||||
setUpdateInfo(params);
|
setUpdateInfo(params);
|
||||||
gridDao.update(params);
|
gridDao.update(params);
|
||||||
@ -183,7 +190,6 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
@Override
|
@Override
|
||||||
public GridDTO get(Map<String, Object> params) {
|
public GridDTO get(Map<String, Object> params) {
|
||||||
GridDTO gridDTO = gridDao.get(params);
|
GridDTO gridDTO = gridDao.get(params);
|
||||||
|
|
||||||
return gridDTO;
|
return gridDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,4 +561,30 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
return gridDao.getAreaLastPO(params);
|
return gridDao.getAreaLastPO(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增网格编码
|
||||||
|
*
|
||||||
|
* @param areaCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getSaveGridCode(String areaCode) {
|
||||||
|
GridPO areaLastPO = getAreaLastPO(areaCode);
|
||||||
|
return areaLastPO == null ? String.format("%s001", areaLastPO.getAreaCode().substring(0, 12)) : String.valueOf(Long.valueOf(areaLastPO.getGridCode()) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取修改网格编码
|
||||||
|
*
|
||||||
|
* @param areaCode
|
||||||
|
* @param gridCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getUpdateGridCode(String areaCode, String gridCode) {
|
||||||
|
GridPO areaLastPO = getAreaLastPO(areaCode);
|
||||||
|
if (areaLastPO == null) {
|
||||||
|
return String.format("%s001", areaCode);
|
||||||
|
}
|
||||||
|
return areaCode + String.format("%03d", Integer.parseInt(gridCode.substring(12, 15)) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,15 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="fillColor != null and fillColor != ''">
|
<if test="fillColor != null and fillColor != ''">
|
||||||
fill_color = #{fillColor},
|
fill_color = #{fillColor},
|
||||||
|
</if>
|
||||||
|
<if test="gridCode != null and gridCode != ''">
|
||||||
|
grid_code = #{gridCode},
|
||||||
|
</if>
|
||||||
|
<if test="areaCode != null and areaCode != ''">
|
||||||
|
area_code = #{areaCode},
|
||||||
|
</if>
|
||||||
|
<if test="areaName != null and areaName != ''">
|
||||||
|
area_name = #{areaName},
|
||||||
</if>
|
</if>
|
||||||
gmt_modified = #{gmtModified},
|
gmt_modified = #{gmtModified},
|
||||||
modifier = #{modifier}
|
modifier = #{modifier}
|
||||||
|
@ -298,7 +298,7 @@
|
|||||||
});
|
});
|
||||||
$(document).on('click', '#showGrid', function() {
|
$(document).on('click', '#showGrid', function() {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
url: top.restAjax.path('route/grid/show-grid', []),
|
url: top.restAjax.path('route/grid/show-grid?areaCode={areaCode}', [$('#areaCode').val()]),
|
||||||
title: '查看网格',
|
title: '查看网格',
|
||||||
width: '80%',
|
width: '80%',
|
||||||
height: '80%',
|
height: '80%',
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
.layui-form-label-up {width: 100% !important; height: 30px !important; line-height: 30px !important; border: none !important; padding: 0px !important; font-size: 15px; background-color: transparent !important; text-align: left !important;}
|
.layui-form-label-up {width: 100% !important; height: 30px !important; line-height: 30px !important; border: none !important; padding: 0px !important; font-size: 15px; background-color: transparent !important; text-align: left !important;}
|
||||||
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
||||||
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
||||||
|
.select-area {position: relative;}
|
||||||
|
.select-area #areaName {width: 64%}
|
||||||
|
.select-area .select-btn {position: absolute; top: 30px; right: 0px; width: 36%; border-color: #e6e6e6;}
|
||||||
|
.select-area .select-btn button {height: 38px; width: 50%;}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -49,20 +53,28 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">网格描述</label>
|
<label class="layui-form-label layui-form-label-up">网格描述</label>
|
||||||
<div class="layui-input-block layui-input-block-down">
|
<div class="layui-input-block layui-input-block-down">
|
||||||
<input type="text" id="gridSummary" name="gridSummary" class="layui-input" value="" placeholder="请输入网格描述" maxlength="255" lay-verify="required">
|
<input type="text" id="gridSummary" name="gridSummary" class="layui-input" value="" placeholder="请输入网格描述" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">网格职责</label>
|
<label class="layui-form-label layui-form-label-up">网格职责</label>
|
||||||
<div class="layui-input-block layui-input-block-down">
|
<div class="layui-input-block layui-input-block-down">
|
||||||
<input type="text" id="gridDuty" name="gridDuty" class="layui-input" value="" placeholder="请输入网格职责" maxlength="255" lay-verify="required">
|
<input type="text" id="gridDuty" name="gridDuty" class="layui-input" value="" placeholder="请输入网格职责" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||||
<div class="layui-input-block layui-input-block-down">
|
<div class="layui-input-block layui-input-block-down select-area">
|
||||||
<input type="hidden" id="areaCode" name="areaCode">
|
<input type="hidden" id="areaCode" name="areaCode">
|
||||||
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" lay-verify="required">
|
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" lay-verify="required" readonly>
|
||||||
|
<div class="layui-btn-group select-btn">
|
||||||
|
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||||
|
<i class="fa fa-circle-thin"></i>
|
||||||
|
</button>
|
||||||
|
<button type="button" id="areaCleanBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="删除区域">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -240,7 +252,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#areaName').on('click', function() {
|
// 区域选择
|
||||||
|
(function() {
|
||||||
|
$('#areaSelectBtn').on('click', function() {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '选择地区',
|
title: '选择地区',
|
||||||
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
|
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
|
||||||
@ -265,6 +279,12 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
$('#areaCleanBtn').on('click', function () {
|
||||||
|
$('#areaCode').val('');
|
||||||
|
$('#areaName').val('');
|
||||||
|
})
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
$('#userNames').on('click', function() {
|
$('#userNames').on('click', function() {
|
||||||
top.dialog.dialogData.selectedUserIds = $('#userIds').val();
|
top.dialog.dialogData.selectedUserIds = $('#userIds').val();
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
var queryParams = top.restAjax.params(window.location.href);
|
var queryParams = top.restAjax.params(window.location.href);
|
||||||
var gridId = queryParams.gridId;
|
var gridId = queryParams.gridId;
|
||||||
|
var areaCode = queryParams.areaCode;
|
||||||
var centerPoint = {
|
var centerPoint = {
|
||||||
lng: [[${baiduMapProperties.centerLng}]],
|
lng: [[${baiduMapProperties.centerLng}]],
|
||||||
lat: [[${baiduMapProperties.centerLat}]]
|
lat: [[${baiduMapProperties.centerLat}]]
|
||||||
@ -59,7 +60,7 @@
|
|||||||
// 初始化网格背景
|
// 初始化网格背景
|
||||||
function initGridBG(callback) {
|
function initGridBG(callback) {
|
||||||
var layIndex;
|
var layIndex;
|
||||||
top.restAjax.get(top.restAjax.path('api/grid/list-all-with-point/area-code/{areaCode}', ['1509']), {}, null, function(code, data) {
|
top.restAjax.get(top.restAjax.path('api/grid/list-all-with-point/area-code/{areaCode}', [areaCode ? areaCode : '1509']), {}, null, function(code, data) {
|
||||||
var gridArray = [];
|
var gridArray = [];
|
||||||
for(var i = 0, item; item = data[i++];) {
|
for(var i = 0, item; item = data[i++];) {
|
||||||
var pointArray = [];
|
var pointArray = [];
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
.layui-form-label-up {width: 100% !important; height: 30px !important; line-height: 30px !important; border: none !important; padding: 0px !important; font-size: 15px; background-color: transparent !important; text-align: left !important;}
|
.layui-form-label-up {width: 100% !important; height: 30px !important; line-height: 30px !important; border: none !important; padding: 0px !important; font-size: 15px; background-color: transparent !important; text-align: left !important;}
|
||||||
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
||||||
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
||||||
|
.select-area {position: relative;}
|
||||||
|
.select-area #areaName {width: 64%}
|
||||||
|
.select-area .select-btn {position: absolute; top: 30px; right: 0px; width: 36%; border-color: #e6e6e6;}
|
||||||
|
.select-area .select-btn button {height: 38px; width: 50%;}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -49,13 +53,28 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">网格描述</label>
|
<label class="layui-form-label layui-form-label-up">网格描述</label>
|
||||||
<div class="layui-input-block layui-input-block-down">
|
<div class="layui-input-block layui-input-block-down">
|
||||||
<input type="text" id="gridSummary" name="gridSummary" class="layui-input" value="" placeholder="请输入网格描述" maxlength="255" lay-verify="required">
|
<input type="text" id="gridSummary" name="gridSummary" class="layui-input" value="" placeholder="请输入网格描述" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">网格职责</label>
|
<label class="layui-form-label layui-form-label-up">网格职责</label>
|
||||||
<div class="layui-input-block layui-input-block-down">
|
<div class="layui-input-block layui-input-block-down">
|
||||||
<input type="text" id="gridDuty" name="gridDuty" class="layui-input" value="" placeholder="请输入网格职责" maxlength="255" lay-verify="required">
|
<input type="text" id="gridDuty" name="gridDuty" class="layui-input" value="" placeholder="请输入网格职责" maxlength="255">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||||
|
<div class="layui-input-block layui-input-block-down select-area">
|
||||||
|
<input type="hidden" id="areaCode" name="areaCode">
|
||||||
|
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" lay-verify="required" readonly>
|
||||||
|
<div class="layui-btn-group select-btn">
|
||||||
|
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||||
|
<i class="fa fa-circle-thin"></i>
|
||||||
|
</button>
|
||||||
|
<button type="button" id="areaCleanBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="删除区域">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item layui-layout-admin">
|
<div class="layui-form-item layui-layout-admin">
|
||||||
@ -235,7 +254,9 @@
|
|||||||
}
|
}
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
$('#areaName').on('click', function() {
|
// 区域选择
|
||||||
|
(function() {
|
||||||
|
$('#areaSelectBtn').on('click', function() {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '选择地区',
|
title: '选择地区',
|
||||||
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
|
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
|
||||||
@ -243,9 +264,9 @@
|
|||||||
height: '225px',
|
height: '225px',
|
||||||
onClose: function() {
|
onClose: function() {
|
||||||
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
||||||
|
if(selectedAreaArray.length > 0) {
|
||||||
var areaCode = '';
|
var areaCode = '';
|
||||||
var areaName = '';
|
var areaName = '';
|
||||||
if(selectedAreaArray.length > 0) {
|
|
||||||
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
||||||
for(var i = 0, item; item = selectedAreaArray[i++];) {
|
for(var i = 0, item; item = selectedAreaArray[i++];) {
|
||||||
if(areaName) {
|
if(areaName) {
|
||||||
@ -254,12 +275,17 @@
|
|||||||
areaName += item.areaName;
|
areaName += item.areaName;
|
||||||
}
|
}
|
||||||
initGridBG(areaCode);
|
initGridBG(areaCode);
|
||||||
}
|
|
||||||
$('#areaCode').val(areaCode);
|
$('#areaCode').val(areaCode);
|
||||||
$('#areaName').val(areaName);
|
$('#areaName').val(areaName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
$('#areaCleanBtn').on('click', function () {
|
||||||
|
$('#areaCode').val('');
|
||||||
|
$('#areaName').val('');
|
||||||
|
})
|
||||||
|
})();
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
form.on('submit(submitForm)', function(formData) {
|
form.on('submit(submitForm)', function(formData) {
|
||||||
|
Loading…
Reference in New Issue
Block a user