diff --git a/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java b/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java index 524e7bf..e782908 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java +++ b/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java @@ -1,16 +1,20 @@ package cn.com.tenlion.systemhouse.controller.api.residential; +import cn.com.tenlion.systemhouse.pojo.dtos.grid.GridDTO; import cn.com.tenlion.systemhouse.pojo.dtos.residential.ResidentialDTO; import cn.com.tenlion.systemhouse.pojo.vos.residential.ResidentialVO; +import cn.com.tenlion.systemhouse.remote.grid.IGridRemoteService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService; import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.ErrorResult; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.properties.ApiPathProperties; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -33,6 +37,10 @@ public class ResidentialController extends DefaultBaseController { @Autowired private IResidentialService residentialService; + @Autowired + private IGridRemoteService gridRemoteService; + @Autowired + private ApiPathProperties apiPathProperties; @ApiOperation(value = "新增小区管理表", notes = "新增小区管理表接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @@ -108,4 +116,17 @@ public class ResidentialController extends DefaultBaseController { return new SuccessResultData<>(residentialService.count(params)); } + @ApiOperation(value = "网格列表", notes = "网格列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "query", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("grid-list/{areaCode}") + public List getGridList(@PathVariable("areaCode") String areaCode) { + String sendUrl = apiPathProperties.getUserCenter(); + // String sendUrl = "http://192.168.28.87:8081/systembase/"; + String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken(); + return gridRemoteService.getGridList(sendUrl, areaCode, accessToken); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/grid/GridDTO.java b/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/grid/GridDTO.java new file mode 100644 index 0000000..9cc5060 --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/grid/GridDTO.java @@ -0,0 +1,199 @@ +package cn.com.tenlion.systemhouse.pojo.dtos.grid; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +/** + * + * @ClassName: GridDTO + * @Description: 网格实体类 + * @Author: CodeFactory + * @Date: 2021-10-20 16:00:09 + * @Version: 3.0 + **/ +@ApiModel +public class GridDTO { + + @ApiModelProperty(name = "areaCode", value = "区域编码") + private String areaCode; + @ApiModelProperty(name = "areaName", value = "区域名称") + private String areaName; + @ApiModelProperty(name = "fillColor", value = "填充颜色") + private String fillColor; + @ApiModelProperty(name = "gmtCreate", value = "添加时间") + private String gmtCreate; + @ApiModelProperty(name = "gmtModified", value = "修改时间") + private String gmtModified; + @ApiModelProperty(name = "gridCode", value = "网格编码") + private String gridCode; + @ApiModelProperty(name = "gridDuty", value = "网格职责") + private String gridDuty; + @ApiModelProperty(name = "gridGroupId", value = "网格组ID") + private String gridGroupId; + @ApiModelProperty(name = "gridId", value = "主键") + private String gridId; + @ApiModelProperty(name = "gridName", value = "网格名称") + private String gridName; + @ApiModelProperty(name = "gridSquare", value = "网格面积") + private int gridSquare; + @ApiModelProperty(name = "gridSummary", value = "网格描述") + private String gridSummary; + @ApiModelProperty(name = "relationId", value = "关联ID") + private String relationId; + @ApiModelProperty(name = "pointArray", value = "网格点列表") + private List pointArray; + @ApiModelProperty(name = "relationIdArray", value = "关联ID列表") + private List relationIdArray; + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getFillColor() { + return fillColor; + } + + public void setFillColor(String fillColor) { + this.fillColor = fillColor; + } + + public String getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(String gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public String getGmtModified() { + return gmtModified; + } + + public void setGmtModified(String gmtModified) { + this.gmtModified = gmtModified; + } + + public String getGridCode() { + return gridCode; + } + + public void setGridCode(String gridCode) { + this.gridCode = gridCode; + } + + public String getGridDuty() { + return gridDuty; + } + + public void setGridDuty(String gridDuty) { + this.gridDuty = gridDuty; + } + + public String getGridGroupId() { + return gridGroupId; + } + + public void setGridGroupId(String gridGroupId) { + this.gridGroupId = gridGroupId; + } + + public String getGridId() { + return gridId; + } + + public void setGridId(String gridId) { + this.gridId = gridId; + } + + public String getGridName() { + return gridName; + } + + public void setGridName(String gridName) { + this.gridName = gridName; + } + + public int getGridSquare() { + return gridSquare; + } + + public void setGridSquare(int gridSquare) { + this.gridSquare = gridSquare; + } + + public String getGridSummary() { + return gridSummary; + } + + public void setGridSummary(String gridSummary) { + this.gridSummary = gridSummary; + } + + public String getRelationId() { + return relationId; + } + + public void setRelationId(String relationId) { + this.relationId = relationId; + } + + public List getPointArray() { + return pointArray; + } + + public void setPointArray(List pointArray) { + this.pointArray = pointArray; + } + + public List getRelationIdArray() { + return relationIdArray; + } + + public void setRelationIdArray(List relationIdArray) { + this.relationIdArray = relationIdArray; + } + + public static class PointArrayBean { + private String gridId; + private String lat; + private String lng; + + public String getGridId() { + return gridId; + } + + public void setGridId(String gridId) { + this.gridId = gridId; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + } +} diff --git a/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/residential/ResidentialDTO.java b/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/residential/ResidentialDTO.java index 810123e..ffb4635 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/residential/ResidentialDTO.java +++ b/src/main/java/cn/com/tenlion/systemhouse/pojo/dtos/residential/ResidentialDTO.java @@ -81,6 +81,12 @@ public class ResidentialDTO { private String area5Lng; @ApiModelProperty(name = "area5Lat", value = "下派状态") private String area5Lat; + @ApiModelProperty(name = "location", value = "所在地") + private String location; + @ApiModelProperty(name = "locationCode", value = "所在地编码") + private String locationCode; + @ApiModelProperty(name = "grid", value = "所属网格") + private String grid; public String getResidentialId() { return residentialId == null ? "" : residentialId.trim(); @@ -329,4 +335,28 @@ public class ResidentialDTO { public void setArea5Lat(String area5Lat) { this.area5Lat = area5Lat; } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getGrid() { + return grid; + } + + public void setGrid(String grid) { + this.grid = grid; + } } diff --git a/src/main/java/cn/com/tenlion/systemhouse/pojo/vos/residential/ResidentialVO.java b/src/main/java/cn/com/tenlion/systemhouse/pojo/vos/residential/ResidentialVO.java index 4727d32..ea6caa7 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/pojo/vos/residential/ResidentialVO.java +++ b/src/main/java/cn/com/tenlion/systemhouse/pojo/vos/residential/ResidentialVO.java @@ -56,6 +56,12 @@ public class ResidentialVO { private String community; @ApiModelProperty(name = "remake", value = "备注") private String remake; + @ApiModelProperty(name = "location", value = "所在地") + private String location; + @ApiModelProperty(name = "locationCode", value = "所在地编码") + private String locationCode; + @ApiModelProperty(name = "grid", value = "所属网格") + private String grid; public String getResidentialName() { return residentialName == null ? "" : residentialName.trim(); @@ -217,5 +223,27 @@ public class ResidentialVO { this.remake = remake; } + public String getLocation() { + return location; + } + public void setLocation(String location) { + this.location = location; + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + + public String getGrid() { + return grid; + } + + public void setGrid(String grid) { + this.grid = grid; + } } diff --git a/src/main/java/cn/com/tenlion/systemhouse/remote/grid/IGridRemoteService.java b/src/main/java/cn/com/tenlion/systemhouse/remote/grid/IGridRemoteService.java new file mode 100644 index 0000000..0f437b7 --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemhouse/remote/grid/IGridRemoteService.java @@ -0,0 +1,26 @@ +package cn.com.tenlion.systemhouse.remote.grid; + +import cn.com.tenlion.systemhouse.pojo.dtos.grid.GridDTO; +import cn.com.tenlion.systemhouse.pojo.dtos.population.PopulationDTO; +import ink.wgink.annotation.rpc.rest.RemoteService; +import ink.wgink.annotation.rpc.rest.method.RemoteGetMethod; +import ink.wgink.annotation.rpc.rest.params.RemotePathParams; +import ink.wgink.annotation.rpc.rest.params.RemoteQueryParams; +import ink.wgink.annotation.rpc.rest.params.RemoteServerParams; + +import java.util.List; + +/** + * @ClassName: IGridRemoteService + * @Description: 调取网格信息 + * @Author: CodeFactory + * @Date: 2021-09-24 17:03:54 + * @Version: 3.0 + **/ +@RemoteService +public interface IGridRemoteService { + + @RemoteGetMethod("/resource/grid/list/area-code/{areaCode}") + List getGridList(@RemoteServerParams String remotePath, @RemotePathParams("areaCode") String areaCode, @RemoteQueryParams("access_token") String access_token); + +} diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java b/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java index 07af4bd..06cdc1e 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java @@ -110,7 +110,7 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid @Override public ResidentialDTO get(Map params) { ResidentialDTO residentialDTO = residentialDao.get(params); - if(null != residentialDTO) { + /*if(null != residentialDTO) { AreaDTO area1DTO = getAreaMsg(residentialDTO.getArea1Id()); residentialDTO.setArea1Lng(area1DTO.getAreaLng()); residentialDTO.setArea1Lat(area1DTO.getAreaLat()); @@ -130,7 +130,7 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid AreaDTO area5DTO = getAreaMsg(residentialDTO.getArea5Id()); residentialDTO.setArea5Lng(area5DTO.getAreaLng()); residentialDTO.setArea5Lat(area5DTO.getAreaLat()); - } + }*/ return residentialDTO; } diff --git a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml index 8c00017..fa3d7cc 100644 --- a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml +++ b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml @@ -24,6 +24,9 @@ + + + @@ -98,6 +101,9 @@ phone, community, remake, + location, + location_code, + grid, creator, gmt_create, modifier, @@ -125,6 +131,9 @@ #{phone}, #{community}, #{remake}, + #{location}, + #{locationCode}, + #{grid}, #{creator}, #{gmtCreate}, #{modifier}, @@ -224,6 +233,15 @@ remake = #{remake}, + + + location = #{location}, + + + location_code = #{locationCode}, + + + grid = #{grid}, gmt_modified = #{gmtModified}, modifier = #{modifier}, @@ -255,6 +273,9 @@ t1.phone, t1.community, t1.remake, + t1.location, + t1.location_code, + t1.grid, t1.residential_id FROM house_residential t1 @@ -358,6 +379,9 @@ t1.phone, t1.community, t1.remake, + t1.location, + t1.location_code, + t1.grid, 1 FROM house_residential t1 diff --git a/src/main/resources/templates/residential/save.html b/src/main/resources/templates/residential/save.html index 39cd881..9bf76bc 100644 --- a/src/main/resources/templates/residential/save.html +++ b/src/main/resources/templates/residential/save.html @@ -68,83 +68,22 @@
- -
- - - -
- -
- - -
- - - -
- -
- - -
- - - -
- -
-
- -
-
- - - -
- + + +
+ +
-
- - - -
- @@ -211,6 +150,52 @@ var wangEditor = window.wangEditor; var wangEditorObj = {}; + // 选择所在地 + $(document).on('click', '#location', function() { + top.dialog.open({ + title: '选择地区', + url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#location').val())]), + width: '800px', + height: '225px', + onClose: function () { + var selectedAreaArray = top.dialog.dialogData.selectedAreaArray; + var areaCode = ''; + var areaName = ''; + if (selectedAreaArray.length > 0) { + areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode; + for (var i = 0, item; item = selectedAreaArray[i++];) { + if (areaName) { + areaName += ','; + } + areaName += item.areaName; + } + } + $('#locationCode').val(areaCode); + $('#location').val(areaName); + initGridSelect(areaCode); + } + }) + }); + + // 初始化地区网格 + function initGridSelect(areaCode) { + if(!areaCode) { + laytpl(document.getElementById('gridSelectTemplate').innerHTML).render([], function(html) { + document.getElementById('gridSelectTemplateBox').innerHTML = html; + }); + form.render('select', 'gridSelectTemplateBox'); + return; + } + top.restAjax.get(top.restAjax.path('api/residential/grid-list/{areaCode}', [areaCode]), {}, null, function(code, data, args) { + laytpl(document.getElementById('gridSelectTemplate').innerHTML).render(data, function(html) { + document.getElementById('gridSelectTemplateBox').innerHTML = html; + }); + form.render('select', 'gridSelectTemplateBox'); + }, function(code, data) { + top.dialog.msg(data.msg); + }); + } + // 初始化任务一级地区下拉选择 function initArea1Select() { top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) { @@ -481,11 +466,15 @@ // 初始化内容 function initData() { initRemakeRichText(); - initArea1Select(); + initGridSelect(); + var lng = '113.137743'; + var lat = '41.002057'; + initMap(lng, lat); + /*initArea1Select(); initArea2Select(); initArea3Select(); initArea4Select(); - initArea5Select(); + initArea5Select();*/ } initData(); diff --git a/src/main/resources/templates/residential/update.html b/src/main/resources/templates/residential/update.html index 17e6ddf..88184ae 100644 --- a/src/main/resources/templates/residential/update.html +++ b/src/main/resources/templates/residential/update.html @@ -68,83 +68,22 @@
- -
- - - -
- -
- - -
- - - -
- -
- - -
- - - -
- -
-
- -
-
- - - -
- + + +
+ +
-
- - - -
- @@ -214,6 +153,56 @@ var wangEditor = window.wangEditor; var wangEditorObj = {}; + // 选择所在地 + $(document).on('click', '#location', function() { + top.dialog.open({ + title: '选择地区', + url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#location').val())]), + width: '800px', + height: '225px', + onClose: function () { + var selectedAreaArray = top.dialog.dialogData.selectedAreaArray; + var areaCode = ''; + var areaName = ''; + if (selectedAreaArray.length > 0) { + areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode; + for (var i = 0, item; item = selectedAreaArray[i++];) { + if (areaName) { + areaName += ','; + } + areaName += item.areaName; + } + } + $('#locationCode').val(areaCode); + $('#location').val(areaName); + initGridSelect(areaCode); + } + }) + }); + + // 初始化地区网格 + function initGridSelect(areaCode, selectValue) { + if(!areaCode) { + laytpl(document.getElementById('gridSelectTemplate').innerHTML).render([], function(html) { + document.getElementById('gridSelectTemplateBox').innerHTML = html; + }); + form.render('select', 'gridSelectTemplateBox'); + return; + } + top.restAjax.get(top.restAjax.path('api/residential/grid-list/{areaCode}', [areaCode]), {}, null, function(code, data, args) { + laytpl(document.getElementById('gridSelectTemplate').innerHTML).render(data, function(html) { + document.getElementById('gridSelectTemplateBox').innerHTML = html; + }); + form.render('select', 'gridSelectTemplateBox'); + + var selectObj = {}; + selectObj['grid'] = selectValue; + form.val('dataForm', selectObj); + }, function(code, data) { + top.dialog.msg(data.msg); + }); + } + // 初始化任务一级地区下拉选择 function initArea1Select(selectValue, value, dataValue) { if(!dataValue) { @@ -528,7 +517,7 @@ } form.val('dataForm', dataFormData); form.render(null, 'dataForm'); - var area1Data = data['area1Id'] + ',' + data['area1Lng'] + ',' + data['area1Lat'] + ',' + data['area1Name']; + /*var area1Data = data['area1Id'] + ',' + data['area1Lng'] + ',' + data['area1Lat'] + ',' + data['area1Name']; var area2Data = data['area2Id'] + ',' + data['area2Lng'] + ',' + data['area2Lat'] + ',' + data['area2Name']; var area3Data = data['area3Id'] + ',' + data['area3Lng'] + ',' + data['area3Lat'] + ',' + data['area3Name']; var area4Data = data['area4Id'] + ',' + data['area4Lng'] + ',' + data['area4Lat'] + ',' + data['area4Name']; @@ -537,9 +526,15 @@ initArea2Select(area1Data, area2Data, area2Data); initArea3Select(area2Data, area3Data, area3Data); initArea4Select(area3Data, area4Data, area4Data); - initArea5Select(area4Data, area5Data, area5Data); - - initMap(data['longitude'], data['latitude']); + initArea5Select(area4Data, area5Data, area5Data);*/ + initGridSelect(data['locationCode'], data['grid']); + if(!data['longitude']) { + var lng = '113.137743'; + var lat = '41.002057'; + initMap(lng, lat); + }else { + initMap(data['longitude'], data['latitude']); + } initRemakeRichText(data['remake']); }, function(code, data) { top.dialog.msg(data.msg);