首页搜索,和标签信息

This commit is contained in:
TS-QD1 2024-02-01 16:09:12 +08:00
parent e4310149a3
commit 8348de3159
8 changed files with 516 additions and 255 deletions

View File

@ -63,4 +63,6 @@ public class CommunityBossDTO implements Serializable {
private String communityName;
@ApiModelProperty(name = "gridSummary", value = "网格描述")
private String gridSummary;
private String gridIds;
private String gridNames;
}

View File

@ -145,15 +145,15 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
return easyUITreeDTOs;
}
private List<EasyUITreeDTO> setArea(){
private List<EasyUITreeDTO> setArea() {
List<EasyUITreeDTO> resList = new ArrayList<>();
Map<String, Object> param = new HashMap<>(4);
param.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c");
// 查询街道
List<DictDTO> areaList = dictService.listDict(param);
for(DictDTO item : areaList){
for (DictDTO item : areaList) {
// 剔除专管员区域画网格用
if("e64a0a05-45ca-4452-a869-a4dcbff74593".equals(item.getDictId())){
if ("e64a0a05-45ca-4452-a869-a4dcbff74593".equals(item.getDictId())) {
continue;
}
EasyUITreeDTO dto = new EasyUITreeDTO();
@ -169,13 +169,13 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
return resList;
}
private List<EasyUITreeDTO> setCommunity(String areaId){
private List<EasyUITreeDTO> setCommunity(String areaId) {
List<EasyUITreeDTO> resList = new ArrayList<>();
Map<String, Object> param = new HashMap<>(4);
param.put("areaId", areaId);
// 查询社区
List<CommunityDTO> communityDTOS = communityService.listCommunity(param);
for (CommunityDTO item : communityDTOS){
for (CommunityDTO item : communityDTOS) {
EasyUITreeDTO dto = new EasyUITreeDTO();
dto.setId("community_" + item.getCommunityId());
dto.setText(item.getCommunityName());
@ -189,13 +189,13 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
return resList;
}
private List<EasyUITreeDTO> setGridUser(String areaId, String communityId){
private List<EasyUITreeDTO> setGridUser(String areaId, String communityId) {
List<EasyUITreeDTO> resList = new ArrayList<>();
Map<String, Object> param = new HashMap<>(4);
param.put("areaId", areaId);
param.put("communityId", communityId);
List<CommunityBossDTO> list = communityBossService.listGridUser(param);
for (CommunityBossDTO item : list){
for (CommunityBossDTO item : list) {
EasyUITreeDTO dto = new EasyUITreeDTO();
dto.setId("areaUser_" + item.getCommunityBossUserId());
dto.setText(item.getCommunityBossName());
@ -203,6 +203,28 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
dto.setAreaId(areaId);
dto.setChildren(new ArrayList<>());
dto.setNodeTag("user");
// 网格列表
if (org.apache.commons.lang3.StringUtils.isNotBlank(item.getGridNames())) {
String gridIds = item.getGridIds().toString();
String[] gridIdArray = gridIds.split(",");
String codeNames = item.getGridNames().toString();
String[] codeNameArray = codeNames.split(",");
List<EasyUITreeDTO> easyUITreeDTOS = new ArrayList<>();
for (int i = 0; i < codeNameArray.length; i++) {
String codeName = codeNameArray[i];
EasyUITreeDTO easyUITreeDTO = new EasyUITreeDTO();
easyUITreeDTO.setId("grid_" + gridIdArray[i]);
easyUITreeDTO.setText(codeName);
easyUITreeDTO.setIconCls("");
easyUITreeDTO.setAreaId(areaId);
easyUITreeDTO.setNodeTag("grid");
easyUITreeDTOS.add(easyUITreeDTO);
}
dto.setChildren(easyUITreeDTOS);
} else {
dto.setChildren(new ArrayList<>());
}
resList.add(dto);
}
return resList;
@ -225,20 +247,41 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
return resList;
}
private List<EasyUITreeDTO> setNPerson(String departmentId){
private List<EasyUITreeDTO> setNPerson(String departmentId) {
List<EasyUITreeDTO> resList = new ArrayList<>();
Map<String, Object> param = new HashMap<>(4);
param.put("departmentId", departmentId);
List<Map<String, Object>> list = bindingDepartmentService.listNPerson(param);
for(Map<String, Object> item : list ){
for (Map<String, Object> item : list) {
EasyUITreeDTO dto = new EasyUITreeDTO();
dto.setId("nPerson_" + item.get("userId"));
dto.setText(item.get("userName").toString());
dto.setIconCls("icon-person");
dto.setAreaId("");
dto.setDepartmentId(departmentId);
dto.setChildren(new ArrayList<>());
dto.setNodeTag("user");
// 网格列表
if (item.get("gridNames") != null && !StringUtils.isEmpty(item.get("gridNames").toString())) {
String gridIds = item.get("gridIds").toString();
String[] gridIdArray = gridIds.split(",");
String codeNames = item.get("gridNames").toString();
String[] codeNameArray = codeNames.split(",");
List<EasyUITreeDTO> easyUITreeDTOS = new ArrayList<>();
for (int i = 0; i < codeNameArray.length; i++) {
String codeName = codeNameArray[i];
EasyUITreeDTO easyUITreeDTO = new EasyUITreeDTO();
easyUITreeDTO.setId("grid_" + gridIdArray[i]);
easyUITreeDTO.setText(codeName);
easyUITreeDTO.setIconCls("");
easyUITreeDTO.setAreaId("");
easyUITreeDTO.setDepartmentId(departmentId);
easyUITreeDTO.setNodeTag("grid");
easyUITreeDTOS.add(easyUITreeDTO);
}
dto.setChildren(easyUITreeDTOS);
} else {
dto.setChildren(new ArrayList<>());
}
resList.add(dto);
}
return resList;

View File

@ -389,6 +389,18 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
gridUser.setCommunityBossName(item.get("user_name").toString());
if (relationGridList != null && relationGridList.size() > 0) {
gridUser.setCommunityBossName("[有网格] " + item.get("user_name").toString());
String gridIds = "";
String gridNames = "";
for (Map<String, Object> relationGridMap : relationGridList) {
if (!gridIds.isEmpty()) {
gridIds += ",";
gridNames += ",";
}
gridIds += relationGridMap.get("gridId");
gridNames += relationGridMap.get("gridName");
}
gridUser.setGridIds(gridIds);
gridUser.setGridNames(gridNames);
}
gridUser.setCommunityBossUserId(item.get("community_boss_user_id").toString());
list.add(gridUser);

View File

@ -159,12 +159,15 @@
t2.user_name userName,
t2.user_phone userPhone,
t3.relation_id relationId,
t4.department_id departmentId
t4.department_id departmentId,
GROUP_CONCAT(t5.grid_id) gridIds,
GROUP_CONCAT(t5.grid_name) gridNames
FROM
sys_role_user t1
LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
LEFT JOIN map_grid_relation t3 ON t1.user_id = t3.relation_id
LEFT JOIN sys_department_user t4 ON t1.user_id = t4.user_id
LEFT JOIN map_grid t5 ON t5.grid_id = t3.grid_id AND t5.is_delete = 0
WHERE
t1.role_id = 'bc405346-8714-4ded-89ac-9cc4d755f66a'
AND t2.is_delete = '0'
@ -177,6 +180,12 @@
<if test="userName != null and userName !=''">
AND t2.user_name = #{userName}
</if>
GROUP BY
t1.user_id,
t2.user_name,
t2.user_phone,
t3.relation_id,
t4.department_id
ORDER BY LENGTH(t3.relation_id) DESC
</select>

View File

@ -108,15 +108,40 @@
</select>
<select id="listMapGrid" parameterType="map" resultType="map">
select *
from map_grid
select
*
from
map_grid mg
where
is_delete = '0'
mg.is_delete = '0'
<if test="gridId !=null and gridId !=''">
and grid_id = #{gridId}
and mg.grid_id = #{gridId}
</if>
<if test="areaCode !=null and areaCode !=''">
and area_code LIKE CONCAT('%',CONCAT(#{areaCode}, '%'))
and mg.area_code LIKE CONCAT('%',#{areaCode}, '%')
</if>
<if test="keywords != null and keywords != ''">
AND (
mg.grid_name LIKE CONCAT('%', #{keywords}, '%')
OR
mg.grid_id IN (
SELECT
mgr.grid_id
FROM
map_grid_relation mgr
INNER JOIN
sys_user su
ON
mgr.relation_id = su.user_id
WHERE
su.is_delete = 0
AND (
su.user_username LIKE CONCAT('%', #{keywords}, '%')
OR
su.user_name LIKE CONCAT('%', #{keywords}, '%')
)
)
)
</if>
</select>

View File

@ -671,6 +671,21 @@ BaiduMap.prototype.initBackgroundGrid = function (option) {
polygon.addEventListener('click', function (event) {
option.onClick(backgroundGrid, event);
});
polygon.addEventListener('mouseover', function(event) {
if(option.onMouseover) {
option.onMouseover(backgroundGrid, event);
}
})
polygon.addEventListener('mouseout', function(event) {
if(option.onMouseout) {
option.onMouseout(backgroundGrid, event);
}
})
polygon.addEventListener('mousemove', function(event) {
if(option.onMousemove) {
option.onMousemove(backgroundGrid, event);
}
})
}
for (var i = 0, backgroundGrid; backgroundGrid = option.gridArray[i++];) {

View File

@ -53,6 +53,70 @@
.anchorBL{
display:none;
}
.search-container {
position: absolute;
top: 5px;
left: 50%;
margin-left: -205px;
z-index: 1000;
padding: 5px;
background-color: #FFF;
box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
}
.search-container input {
outline: none;
width: 300px;
height: 32px;
border: 1px solid #e6e6e6;
}
.search-container button {
height: 32px;
background-color: rgba(34, 190, 239, 0.6);
border: none;
color: #FFF;
}
.search-container button:hover {
background-color: rgba(34, 190, 239, 0.8);
}
.search-container button:active {
background-color: rgba(34, 190, 239, 1);
}
.grid-info {
display: none;
position: absolute;
top: 0;
left: 0;
max-width: 600px;
background-color: #FFFFFF;
padding: 5px;
}
.grid-info .users {
font-size: 0;
}
.grid-info .users span {
font-size: 13px;
}
.grid-info .users span:after {
content: '|';
margin-left: 5px;
margin-right: 5px;
}
.grid-info .users span:last-child:after {
content: ''
}
.grid-info:after {
content: ' ';
display: block;
position: absolute;
bottom: -20px;
left: 0;
border-width: 10px;
border-style: solid;
border-left-color: #FFFFFF;
border-top-color: #FFFFFF;
border-right-color: transparent;
border-bottom-color: transparent;
}
</style>
</head>
<body>
@ -96,12 +160,34 @@
<i id="arrow" class="fa fa-angle-double-up"></i>
</div>
</div>
<div class="search-container">
<span>关键字</span>
<input type="text" id="searchInput" placeholder="请输入网格员姓名或网格编号" v-model="keywords"/>
<button type="button" id="searchBtn" @click="onSearch"><i class="fa fa-search"></i> 搜索</button>
</div>
<!--<div style="padding:5px;border:1px solid silver;background-color:#FFF;position:absolute;top:5px;right:5px;z-index:10000;" v-cloak>
<span>经度: <i>{{location.lng}}</i></span>,
<span>纬度: <i>{{location.lat}}</i></span>
</div>-->
<div id="mapContainer"></div>
</div>
<div class="grid-info" id="gridInfo">
<div class="grid">
<span>网格名称:</span>
<span class="grid-name" id="gridName">网格名称啥的</span>
</div>
<div class="area">
<span>地区:</span>
<span class="area-name" id="areaName">地区/社区</span>
</div>
<div class="line">
<hr style="margin-top: 5px; margin-bottom: 5px"/>
</div>
<div class="users" id="gridUsers">
<span>XXXXX</span>
<span>XXXXX</span>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=pFMM3KjMlPlpzEGTXwB5vdj6cDCfB6Py"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/AreaRestriction/1.2/src/AreaRestriction_min.js"></script>
@ -111,7 +197,7 @@
<script type="text/javascript" src="assets/js/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="assets/js/vue.min.js"></script>
<script type="text/javascript" src="assets/js/common.js"></script>
<script type="text/javascript" src="assets/js/baidu-map-0.0.1.min.js"></script>
<script type="text/javascript" src="assets/js/baidu-map-0.0.1.min.js?v=20240201"></script>
<script type="text/javascript" src="assets/js/vendor/layer/layer.js"></script>
<script type="text/javascript">
new Vue({
@ -141,7 +227,10 @@
},
personTreeSelectNodes: [],
isAllCheck: false,
isTakeUserArea: false
isTakeUserArea: false,
keywords: '',
mouseOverGridId: '',
mouseOverTimeout: null
},
methods: {
// 创建地图实例
@ -225,7 +314,49 @@
if(self.isTakeUserArea) {
self.getAreaUsersInfo(item.id);
}
}
},
onMouseover: function(item, event) {
var $gridInfo = $('#gridInfo');
$gridInfo.hide();
self.mouseOverGridId = item.gridId;
if(self.mouseOverTimeout) {
clearTimeout(self.mouseOverTimeout);
}
self.mouseOverTimeout = setTimeout(function() {
top.restAjax.get(top.restAjax.path('app/data-external-release/get-big-data-grid-detail', []), {gridId : item.id}, null, function(code, data) {
console.log(data);
$('#gridName').text(data.gridInfo.gridName);
$('#areaName').text(data.gridInfo.areaName);
var users = '';
$.each(data.gridUser, function(index, item) {
users += `<span>${item.userName}:${item.userPhone}</span>`
});
var $gridUsers = $('#gridUsers');
$gridUsers.empty();
$gridUsers.append(users);
$gridInfo.show();
}, function(code, data) {
dialog.msg(data.msg);
});
}, 1000);
},
onMouseout: function() {
$('#gridInfo').hide();
if(self.mouseOverTimeout) {
clearTimeout(self.mouseOverTimeout);
}
},
onMousemove: function(item, event) {
if(self.mouseOverGridId !== item.gridId) {
return;
}
var pixel = event.pixel;
var $gridInfo = $('#gridInfo');
$gridInfo.css({
top: pixel.y - ($gridInfo.height() + 30) +'px',
left: pixel.x +'px'
})
},
});
}
if(typeof(addPoints) != 'undefined') {
@ -272,6 +403,10 @@
var userId = node.id.replace(/nPerson_/g, '');
self.initGridUserV2(node.nodeTag, 15, userId);
}
if(node.nodeTag == 'grid'){
var gridId = node.id.replace(/grid_/g, '');
self.initGridUserV2(node.nodeTag, 17, gridId);
}
},
onLoadSuccess: function() {
var node = $('#areaTree').tree('find', 'areaTop');
@ -536,6 +671,31 @@
var self = this;
self.map.map.setViewport(points);
},
onSearch: function() {
var self = this;
if(!self.keywords) {
layer.msg('请输入关键字');
return;
}
self.map.clearMap();
top.restAjax.get(top.restAjax.path('app/data-external-release/list-map-grid-search', []), {
keywords: encodeURI(self.keywords)
}, null, function(code, data) {
if(typeof (data) != 'undefined' && data.length > 0){
// 划片
self.takeUserArea(data);
if(data[0]['gridPointList'].length <= 0){
return;
}
self.map.setCenterAndZoom({
lng: data[0]['gridPointList'][0].lng,
lat: data[0]['gridPointList'][0].lat
}, 15);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
},
mounted: function() {
var self = this;