处理人员网格和轨迹无法正常显示的问题

This commit is contained in:
wanggeng 2021-10-19 15:18:05 +08:00
parent f01f3a66ba
commit e111303d27
7 changed files with 285 additions and 21 deletions

View File

@ -1,7 +1,5 @@
package com.cm.systemcity.service.communityboss;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
@ -14,7 +12,6 @@ import com.cm.systemcity.pojo.dtos.community.CommunityDTO;
import com.cm.systemcity.pojo.dtos.communityboss.CommunityBossAreaDTO;
import com.cm.systemcity.pojo.dtos.communityboss.CommunityBossDTO;
import com.cm.systemcity.pojo.pos.communityboss.CommunityBossPO;
import com.cm.systemcity.pojo.vos.communityboss.CommunityBossExcelVO;
import java.util.List;
import java.util.Map;
@ -209,4 +206,11 @@ public interface ICommunityBossService {
*/
List<String> listUserIds(String userId, int communityBossLevel);
/**
* 网格列表
*
* @param userIds
* @return
*/
List<CommunityBossPO> listPOByUserIds(List<String> userIds);
}

View File

@ -28,13 +28,10 @@ import com.cm.systemcity.service.communityboss.ICommunityBossService;
import com.cm.systemcity.service.dict.IDictService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sun.jna.platform.win32.OaIdl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
/**
@ -432,6 +429,16 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
return new ArrayList<>(userIdSet);
}
@Override
public List<CommunityBossPO> listPOByUserIds(List<String> userIds) {
if(userIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("communityBossUserIds", userIds);
return communityBossDao.listPO(params);
}
/**
* 网格长详情
*

View File

@ -23,6 +23,7 @@ import com.cm.systemcity.pojo.dtos.communityboss.CommunityBossDTO;
import com.cm.systemcity.pojo.dtos.dict.DictDTO;
import com.cm.systemcity.pojo.dtos.gridmember.GridMemberGridFullDTO;
import com.cm.systemcity.pojo.dtos.userpoints.UserAndPointsDTO;
import com.cm.systemcity.pojo.pos.communityboss.CommunityBossPO;
import com.cm.systemcity.pojo.vos.AreaPointsVO;
import com.cm.systemcity.pojo.vos.AreaVO;
import com.cm.systemcity.pojo.vos.userpoints.UserAndPointsVO;
@ -152,8 +153,8 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
EasyUITreeDTO areaEasyUITreeDTO = new EasyUITreeDTO("area_" + area.getDictId(), area.getDictName(), null, "icon-area");
List<EasyUITreeDTO> subAreaEasyUITreeDTO = new ArrayList<>();
areaEasyUITreeDTO.setChildren(subAreaEasyUITreeDTO);
for(EasyUITreeDTO communityEasyUITreeDTO : communityEasyUITreeDTOs) {
if(StringUtils.equals(area.getDictId(), communityEasyUITreeDTO.getAreaId())) {
for (EasyUITreeDTO communityEasyUITreeDTO : communityEasyUITreeDTOs) {
if (StringUtils.equals(area.getDictId(), communityEasyUITreeDTO.getAreaId())) {
subAreaEasyUITreeDTO.add(communityEasyUITreeDTO);
}
}
@ -527,8 +528,8 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
* 添加修改颜色
*/
Map<String, Object> updateMap = new HashMap<>(8);
updateMap.put("gridId",gridVO.getId());
updateMap.put("fillColor",gridVO.getFillColor());
updateMap.put("gridId", gridVO.getId());
updateMap.put("fillColor", gridVO.getFillColor());
userPointsDao.updateGridColor(updateMap);
gridService.updateGridPointArrayByGridId(gridVO.getId(), gridVO.getPointArray());
}
@ -544,13 +545,11 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
@Override
public List<GridDTO> listUserAndPointsByUserIdsByGridService(Map<String, Object> params) {
String userIds = params.get("userIds").toString();
params.clear();
// 查找网格员信息网格员关联的是communityBossId其他则是userId
String[] userIdArray = userIds.split(",");
List<String> userIdList = Arrays.asList(userIdArray);
// 创建userId集合用于请求GridService接口
List<String> userIdList = new ArrayList<>();
for (String userId : userIds.split(",")) {
userIdList.add(userId);
}
List<GridDTO> userAndPointsDTOList = gridService.listGridGroupByRelationIds(userIdList);
List<GridDTO> userAndPointsDTOList = gridService.listGridGroupByRelationIds(listGridUserIds(userIdList));
return userAndPointsDTOList;
}
@ -571,10 +570,35 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
@Override
public List<GridDTO> listUserPointsByGridService(List<String> userIds) throws SearchException {
List<GridDTO> userAndPointsDTOs = gridService.listGridByRelationIds(userIds);
List<GridDTO> userAndPointsDTOs = gridService.listGridByRelationIds(listGridUserIds(userIds));
return userAndPointsDTOs;
}
/**
* 得到网格用户ID列表处理因N员与网格员relationId类型不同导致的网格无法显示问题
*
* @param userIdList
* @return
*/
private List<String> listGridUserIds(List<String> userIdList) {
List<CommunityBossPO> communityBossPOs = communityBossService.listPOByUserIds(userIdList);
Set<String> relationIdSet = new HashSet<>();
for (String userId : userIdList) {
boolean isUserExist = false;
for (CommunityBossPO communityBossPO : communityBossPOs) {
if (StringUtils.equals(userId, communityBossPO.getCommunityBossUserId())) {
isUserExist = true;
relationIdSet.add(communityBossPO.getCommunityBossId());
break;
}
}
if (!isUserExist) {
relationIdSet.add(userId);
}
}
return new ArrayList<>(relationIdSet);
}
@Override
public List<GridDTO> listUserAndPointsByDepartmentByGridService(Map<String, Object> params) {
JSONArray userArray = userService.listDepartmentUsers(params);

View File

@ -0,0 +1,148 @@
server:
port: 7022
url: http://192.168.0.103:7022/servicecity
title: 生态环保网格化监督平台
servlet:
context-path: /servicecity
tomcat:
uri-encoding: UTF-8
max-threads: 500
max-connections: 10000
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML5
encoding: UTF-8
cache: false
main:
allow-bean-definition-overriding: true
servlet:
multipart:
max-file-size: 1GB
max-request-size: 1GB
datasource:
druid:
url: jdbc:mysql://localhost:3306/db_btgxq_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
initial-size: 2
min-idle: 2
max-active: 10
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 10
filter:
commons-log:
connection-logger-name: stat,wall,log4j
stat:
log-slow-sql: true
slow-sql-millis: 2000
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
use-global-data-source-stat: true
cache:
type: ehcache
ehcache:
config: classpath:ehcache.xml
# 数据库
mybatis:
config-location: classpath:mybatis/mybatis-config.xml
mapper-locations: classpath*:mybatis/mapper/**/*.xml
# 文档
swagger:
title: 接口文档
description: 生态环保网格化监督平台接口文档
service-url: http://106.12.218.237:8001/servicecity
version: 1.0
swagger-base-package: com.cm
# 文件
file:
uploadPath: /Users/wanggeng/Desktop/UploadFiles/
imageTypes: png,jpg,jpeg,gif,blob
videoTypes: mp4,rmvb
audioTypes: mp3,wmv,wav
fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk
# 安全
security:
oauth2:
oauth-server: http://192.168.0.103:7021/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: c024a89b35b04d4d8b5b4ea4d66a8acb
client-secret: MlMzaC9sYkxKMDZtQzlRLzJwVGVMbnhaVmhTZEJQR1BiT0c4SDgrRjd5VW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
grant-type: authorization_code
resource:
jwt:
key-uri: ${security.oauth2.oauth-server}/oauth_client/token_key
token-info-uri: ${security.oauth2.oauth-server}/oauth_client/check_token
user-info-uri: ${security.oauth2.oauth-server}/user
authorization:
check-token-access: ${security.oauth2.oauth-server}/oauth_client/token_key
api-path:
user-center: ${security.oauth2.oauth-server}
# 访问控制
access-control:
pass-paths:
- /index
- /index.html
- /logout.html
- /default.html
- /app/**
- /assets/**
save-paths:
- /save*/**
- /add*/**
delete-paths:
- /delete*/**
- /remove*/**
update-paths:
- /update*/**
- /edit*/**
query-paths:
- /get*/**
- /query*/**
- /find*/**
- /list*/**
- /count*/**
- /map*/**
- /select*/**
# 日志
logging:
file: /Users/wanggeng/Desktop/UploadFiles/logs/servicecity/logs.log
level:
root: error
com.cm: debug
socket:
central-control:
active: false
client:
client-id: 09991939-25af-4423-9128-f28ef1a1bce1
client-secret: BJ5Z5FxAuCTIUXkZHNh50R7zPrJMjE+LbesNFSg9WC6NdSFL9bxaQzSVpOcItgV1
host: 49.233.36.36
port: 8888
max-reconnect-count: 20
reconnect-time-step: 1
delay-ping-seconds: 3
send-client-info-active: false
# 上报服务器数据时间
send-client-info-second: 30

View File

@ -911,3 +911,84 @@ BaiduMap.prototype.setGridArray = function (gridArray) {
setPolygon(grid);
}
}
BaiduMap.prototype.markWithUserAvatarWithTitle = function(map, point, avatar, title) {
function UserAvatar(map, point, avatar, title) {
this.baiduMap = map;
this.point = point;
this.avatar = avatar;
this.title = title;
}
UserAvatar.prototype = new BMap.Overlay();
UserAvatar.prototype.initialize = function () {
var self = this;
var userAvatarBox = this.userAvatarBox = document.createElement('div');
userAvatarBox.style.position = 'absolute';
userAvatarBox.style.zIndex = BMap.Overlay.getZIndex(this.point.lat);
userAvatarBox.style.backgroundColor = 'green';
userAvatarBox.style.border = '1px solid white';
userAvatarBox.style.width = '50px';
userAvatarBox.style.height = '50px';
userAvatarBox.style.borderRadius = '25px 25px 0 0';
var userAvatar = this.userAvatar = document.createElement('img');
userAvatar.style.width = '40px';
userAvatar.style.height = '40px';
userAvatar.style.margin = '4px';
userAvatar.style.backgroundColor = 'white';
userAvatar.style.borderRadius = '20px';
if (avatar == '') {
userAvatar.setAttribute('src', 'assets/images/profile-photo.jpg');
} else {
userAvatar.setAttribute('src', 'route/file/downloadfile/true/' + avatar);
}
userAvatarBox.appendChild(userAvatar);
var userTitle = this.userTitle = document.createElement('div');
userTitle.style.position = 'absolute';
userTitle.style.width = '160px';
userTitle.style.padding = '2px';
userTitle.style.borderRadius = '13px';
userTitle.style.backgroundColor = 'green';
userTitle.style.color = 'white';
userTitle.style.border = '1px solid white';
userTitle.style.textAlign = 'center';
userTitle.style.top = '48px';
userTitle.style.left = '-60px';
userTitle.appendChild(document.createTextNode(this.title));
userAvatarBox.appendChild(userTitle);
var arrow = this.arrow = document.createElement("div");
arrow.setAttribute('class', 'arrow');
arrow.style.position = 'absolute';
arrow.style.width = '0';
arrow.style.height = '0';
arrow.style.borderWidth = '10px';
arrow.style.borderStyle = 'solid';
arrow.style.borderColor = 'green transparent transparent transparent';
arrow.style.top = '72px';
arrow.style.left = '14px';
arrow.style.overflow = 'hidden';
userAvatarBox.appendChild(arrow);
map.getPanes().labelPane.appendChild(userAvatarBox);
return userAvatarBox;
}
UserAvatar.prototype.draw = function () {
var pixel = this.baiduMap.pointToOverlayPixel(this.point);
this.userAvatarBox.style.left = (pixel.x - 26) + 'px';
this.userAvatarBox.style.top = (pixel.y - 82) + 'px';
this.userTitle.innerHTML = this.title;
}
UserAvatar.prototype.setPosition = function (point, time) {
this.point = point;
this.title = time;
this.draw();
}
return new UserAvatar(map, point, avatar, title);
}

View File

@ -160,7 +160,7 @@
$('#time_'+ index).addClass('time-active');
},
search: function() {
this.map.clearOverlays();
this.map.map.clearOverlays();
this.initLocation();
},
// 点动
@ -180,7 +180,7 @@
},
makePointRun: function () {
var self = this;
self.runPoint = markWithUserAvatarWithTitle(self.map, new BMap.Point(self.points[0].lng, self.points[0].lat), self.points[0].avatar, self.points[0].time);
self.runPoint = self.map.markWithUserAvatarWithTitle(self.map.map, new BMap.Point(self.points[0].lng, self.points[0].lat), self.points[0].avatar, self.points[0].time);
self.map.map.addOverlay(self.runPoint);
clearTimeout(self.pointRunTimeout);
self.startPlayPointIndex = 0;
@ -273,7 +273,7 @@
strokeColor: lineColor,
strokeStyle: lineStyle
});
this.map.addOverlay(polyline);
this.map.map.addOverlay(polyline);
},
initLocus: function() {
var self = this;

View File

@ -227,7 +227,7 @@
},
dataFilter: function(treeId, parentNode, childNodes) {
for(var i = 0, item = childNodes[i]; item = childNodes[i++];) {
item.id = item.communityBossId;
item.id = item.communityBossId,
item.name = item.communityBossName;
}
return childNodes;