首页信息显示问题修改

This commit is contained in:
wans 2021-11-29 10:26:46 +08:00
parent ef2aff28c9
commit 86be6e2620
13 changed files with 366 additions and 21 deletions

View File

@ -1,5 +1,6 @@
package com.cm.systemcity.dao.bindingdepartment;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.systemcity.pojo.dtos.bindingdepartment.BindingDepartmentDTO;
import org.springframework.stereotype.Repository;
@ -40,4 +41,6 @@ public interface IBindingDepartmentDao {
* @return
*/
BindingDepartmentDTO getBindingDepartment(Map<String, Object> params);
List<DepartmentSortDTO> listDepartmentForMainPanel(Map<String, Object> query);
}

View File

@ -14,7 +14,11 @@ public enum MongoCollections {
LIST_USER_AND_POINTS_BY_LEVEL_BY_GRID_SERVICE_1("listUserAndPointsByLevelByGridService1", "2级网格长网格点集合"),
LIST_USER_AND_POINTS_BY_LEVEL_BY_GRID_SERVICE_2("listUserAndPointsByLevelByGridService2", "3级网格长网格点集合"),
LIST_USER_AND_POINTS_BY_LEVEL_BY_GRID_SERVICE_3("listUserAndPointsByLevelByGridService3", "4级网格长网格点集合"),
LIST_USER_AND_POINTS_BY_LEVEL_BY_GRID_SERVICE_4("listUserAndPointsByLevelByGridService4", "5级网格员网格点集合");
LIST_USER_AND_POINTS_BY_LEVEL_BY_GRID_SERVICE_4("listUserAndPointsByLevelByGridService4", "5级网格员网格点集合"),
LIST_AREA_FROM_CITY_SYSTEM("listAreaFromCitySystem", "市域治理系统行政区划(稀土、民馨、万水泉)"),
LIST_COMMUNITY_BY_AREA_1("listCommunityByArea1", "稀土路村社区集合"),
LIST_COMMUNITY_BY_AREA_2("listCommunityByArea2", "民馨路村社区集合"),
LIST_COMMUNITY_BY_AREA_3("listCommunityByArea3", "万水泉村社区集合");
private String collection;
private String summary;

View File

@ -25,6 +25,7 @@ import com.cm.systemcity.pojo.vos.AreaVO;
import com.cm.systemcity.pojo.vos.areapoints.AreaAndPointsVO;
import com.cm.systemcity.pojo.vos.areapoints.AreaGridVO;
import com.cm.systemcity.service.areapoints.IAreaPointsService;
import com.cm.systemcity.service.bindingdepartment.IBindingDepartmentService;
import com.cm.systemcity.service.dict.IDictService;
import com.cm.systemcity.service.userpoints.IUserPointsService;
import org.springframework.beans.factory.annotation.Autowired;
@ -61,6 +62,8 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
private IDataDictionaryService dataDictionaryService;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private IBindingDepartmentService bindingDepartmentService;
@Override
public SuccessResult saveAreaAndPoints(AreaAndPointsVO areaAndPointsVO) throws SaveException, SearchException, UpdateException, RemoveException {
@ -115,13 +118,13 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
List<EasyUITreeDTO> easyUITreeDTOs = mongoTemplate.find(new Query(), EasyUITreeDTO.class, MongoCollections.LIST_AREA_TREE.getCollection());
if (easyUITreeDTOs.isEmpty()) {
easyUITreeDTOs = new ArrayList<>();
// 行政区域
EasyUITreeDTO administrativeEasyUITreeDTO = createAreaTreeDTO("administrative", "行政区域", "icon-area");
// 行政区域 (2021-11-18 取掉没有数据的节点)
/*EasyUITreeDTO administrativeEasyUITreeDTO = createAreaTreeDTO("administrative", "行政区域", "icon-area");
List<EasyUITreeDTO> subAdministrativeEasyUITreeDTOS = new ArrayList<>();
subAdministrativeEasyUITreeDTOS.add(createAreaTreeDTO("town", "两办一镇", "icon-area"));
subAdministrativeEasyUITreeDTOS.add(createAreaTreeDTO("community", "社区", "icon-area"));
administrativeEasyUITreeDTO.setChildren(subAdministrativeEasyUITreeDTOS);
easyUITreeDTOs.add(administrativeEasyUITreeDTO);
easyUITreeDTOs.add(administrativeEasyUITreeDTO);*/
// 网格
EasyUITreeDTO areaEasyUITreeDTO = createAreaTreeDTO("area", "网格", "icon-area");
List<EasyUITreeDTO> subAreaEasyUITreeDTOS = new ArrayList<>();
@ -150,10 +153,11 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint
easyUITreeDTOs.add(areaEasyUITreeDTO);
// N员
EasyUITreeDTO nPeopleEasyUITreeDTO = createAreaTreeDTO("nPeople", "委办局", "icon-person-type");
List<DepartmentSortDTO> departmentSortDTOs = departmentService.listSortByType("3");
// 2021-11-18 接口无法返回委办局数据 重新更改查询逻辑
// List<DepartmentSortDTO> departmentSortDTOs = departmentService.listSortByType("3");
List<DepartmentSortDTO> departmentSortDTOs = bindingDepartmentService.listDepartmentForMainPanel(getHashMap(4));
nPeopleEasyUITreeDTO.setChildren(nPeopleToTreeDTO(departmentSortDTOs));
easyUITreeDTOs.add(nPeopleEasyUITreeDTO);
mongoTemplate.insert(easyUITreeDTOs, MongoCollections.LIST_AREA_TREE.getCollection());
}
return easyUITreeDTOs;

View File

@ -2,6 +2,7 @@ package com.cm.systemcity.service.bindingdepartment;
import com.cm.common.exception.SaveException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.systemcity.pojo.dtos.bindingdepartment.BindingDepartmentDTO;
@ -69,4 +70,11 @@ public interface IBindingDepartmentService {
* @return
*/
List<UserDTO> getCaseTypeDepartmentUsers(Map<String, Object> params);
/**
* 查询委办局列表-剔除民馨 万水泉 稀土路
* @param query
* @return
*/
List<DepartmentSortDTO> listDepartmentForMainPanel(Map<String, Object> query);
}

View File

@ -7,6 +7,7 @@ import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO;
import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
@ -147,4 +148,19 @@ public class BindingDepartmentServiceServiceImpl extends BaseService implements
}
return userDTOList;
}
@Override
public List<DepartmentSortDTO> listDepartmentForMainPanel(Map<String, Object> query) {
List<DepartmentSortDTO> list = bindingDepartmentDao.listDepartmentForMainPanel(query);
List<DepartmentSortDTO> resList = new ArrayList<>();
// 剔除街道
for (DepartmentSortDTO item : list){
if( !"f0bf2d8a-e736-4895-a9c8-80f530068c3a".equals(item.getDepartmentId())
&& !"52fecef4-f0f5-4077-999c-39db09872718".equals(item.getDepartmentId())
&& !"1a9b5a0c-d842-46ff-b0c5-36a29b9055df".equals(item.getDepartmentId()) ){
resList.add(item);
}
}
return resList;
}
}

View File

@ -110,4 +110,14 @@ public interface ICommunityService {
* @return
*/
List<CommunityDTO> listByCommunityBossIds(List<String> communityBossIds);
/**
* 初始化村社区信息到Mongo
*/
void initCommunityToMongo();
/**
* 初始化行政区划信息到Mongo
*/
void initAreaToMongo();
}

View File

@ -5,22 +5,26 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.UUIDUtil;
import com.cm.systemcity.dao.community.ICommunityDao;
import com.cm.systemcity.enums.MongoCollections;
import com.cm.systemcity.pojo.dtos.community.CommunityDTO;
import com.cm.systemcity.pojo.dtos.dict.DictDTO;
import com.cm.systemcity.service.community.ICommunityService;
import com.cm.systemcity.service.dict.IDictService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @ClassName: CommunityServiceImpl
@ -34,6 +38,10 @@ public class CommunityServiceImpl extends AbstractService implements ICommunityS
@Autowired
private ICommunityDao communityDao;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private IDictService dictService;
@Override
public SuccessResult saveCommunity(Map<String, Object> params) throws SaveException {
@ -99,4 +107,39 @@ public class CommunityServiceImpl extends AbstractService implements ICommunityS
params.put("communityBossIds", communityBossIds);
return listCommunityByCommunityBoss(params);
}
@Override
public void initCommunityToMongo() {
Map<String, Object> queryMap = new HashMap<>(8);
String areaId = "";
// 稀土路街道
areaId = "7ed23f06-566d-43b7-acd9-4f0b5db08974";
queryMap.put("areaId",areaId);
List<CommunityDTO> communityList1 = listCommunity(queryMap);
mongoTemplate.remove(new Query(), MongoCollections.LIST_COMMUNITY_BY_AREA_1.getCollection());
mongoTemplate.insert(communityList1, MongoCollections.LIST_COMMUNITY_BY_AREA_1.getCollection());
// 民馨路街道
areaId = "6e922367-f21f-4daf-b38c-c55a67d9a35b";
queryMap.put("areaId",areaId);
List<CommunityDTO> communityList2 = listCommunity(queryMap);
mongoTemplate.remove(new Query(), MongoCollections.LIST_COMMUNITY_BY_AREA_2.getCollection());
mongoTemplate.insert(communityList2, MongoCollections.LIST_COMMUNITY_BY_AREA_2.getCollection());
// 万水泉街道
areaId = "8d62a0cc-2c15-4355-906c-6720f8f3617e";
queryMap.put("areaId",areaId);
List<CommunityDTO> communityList3 = listCommunity(queryMap);
mongoTemplate.remove(new Query(), MongoCollections.LIST_COMMUNITY_BY_AREA_3.getCollection());
mongoTemplate.insert(communityList3, MongoCollections.LIST_COMMUNITY_BY_AREA_3.getCollection());
}
@Override
public void initAreaToMongo() {
Map<String, Object> queryMap = new HashMap<>(8);
String parentId = "9d179f05-3ea0-48f7-853c-d3b7124b791c";
queryMap.put("dictParentId",parentId);
List<DictDTO> dictDTOS = dictService.listDict(queryMap);
mongoTemplate.remove(new Query(), MongoCollections.LIST_AREA_FROM_CITY_SYSTEM.getCollection());
mongoTemplate.insert(dictDTOS, MongoCollections.LIST_AREA_FROM_CITY_SYSTEM.getCollection());
}
}

View File

@ -886,6 +886,20 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
@Override
public List<ReportCaseHandleDTO> listReportCaseHandleByCaseType(Map<String, Object> params) throws SearchException {
// 2021-11-18 案件类别添加下级案件ID
List<String> parentCaseTypeList = (List<String>) params.get("caseTypeIds");
List<String> caseTypeIdsList = new ArrayList<>();
for(String parentId : parentCaseTypeList){
caseTypeIdsList.add(parentId);
params.clear();
params.put("dictParentId",parentId);
List<DictDTO> dictDTOS = dictService.listDict(params);
if(dictDTOS != null && dictDTOS.size() > 0){
for(DictDTO item : dictDTOS){
caseTypeIdsList.add(item.getDictId());
}
}
}
return reportCaseDao.listPageReportCaseHandle(params);
}

View File

@ -31,6 +31,7 @@ import com.cm.systemcity.pojo.vos.userpoints.UserAndPointsVO;
import com.cm.systemcity.pojo.vos.userpoints.UserGridVO;
import com.cm.systemcity.pojo.vos.userpoints.UserVO;
import com.cm.systemcity.service.BaseService;
import com.cm.systemcity.service.bindingdepartment.IBindingDepartmentService;
import com.cm.systemcity.service.communityboss.ICommunityBossService;
import com.cm.systemcity.service.dict.IDictService;
import com.cm.systemcity.service.userpoints.IUserPointsService;
@ -66,6 +67,8 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
private IGridService gridService;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private IBindingDepartmentService bindingDepartmentService;
@Override
public SuccessResult saveUserPoints(UserAndPointsVO userAndPointsVO) throws SaveException, UpdateException, RemoveException {
@ -140,15 +143,15 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
if (easyUITreeDTOs == null || easyUITreeDTOs.isEmpty()) {
easyUITreeDTOs = new ArrayList<>();
// 1级网格长
EasyUITreeDTO communityBoss = new EasyUITreeDTO("communityBoss", "网格长", null, "icon-person-type");
EasyUITreeDTO communityBoss = new EasyUITreeDTO("communityBoss", "网格长网格员", null, "icon-person-type");
// 两镇一办
EasyUITreeDTO twoOneEasyUITreeDTO = new EasyUITreeDTO("twoOne", "两镇一办", null, "icon-area");
/*EasyUITreeDTO twoOneEasyUITreeDTO = new EasyUITreeDTO("twoOne", "两镇一办", null, "icon-area");
List<EasyUITreeDTO> twoTownEasyUITreeDTOs = new ArrayList<>();
communityBoss.setChildren(twoTownEasyUITreeDTOs);
twoTownEasyUITreeDTOs.add(twoOneEasyUITreeDTO);
twoTownEasyUITreeDTOs.add(twoOneEasyUITreeDTO);*/
// 行政区划
List<EasyUITreeDTO> areaEasyUITreeDTOs = new ArrayList<>();
twoOneEasyUITreeDTO.setChildren(areaEasyUITreeDTOs);
communityBoss.setChildren(areaEasyUITreeDTOs);
params.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c");
List<DictDTO> areas = dictService.listDict(params);
@ -170,7 +173,9 @@ public class UserPointsServiceImpl extends AbstractService implements IUserPoint
easyUITreeDTOs.add(communityBoss);
// 委办局
EasyUITreeDTO nPeopleEasyUITreeDTO = new EasyUITreeDTO("nPeople", "委办局", null, "icon-person-type");
List<DepartmentSortDTO> departmentSortDTOs = departmentService.listSortByType("3");
// 2021-11-18 接口无法返回委办局数据 重新更改查询逻辑
//List<DepartmentSortDTO> departmentSortDTOs = departmentService.listSortByType("3");
List<DepartmentSortDTO> departmentSortDTOs = bindingDepartmentService.listDepartmentForMainPanel(getHashMap(4));
List<String> departmentIds = new ArrayList<>();
departmentSortDTOs.forEach(departmentSortDTO -> {
departmentIds.add(departmentSortDTO.getDepartmentId());

View File

@ -5,12 +5,16 @@ import com.cm.common.config.properties.OauthProperties;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.utils.RestTemplateUtil;
import com.cm.systemcity.dao.config.IConfigDao;
import com.cm.systemcity.enums.MongoCollections;
import com.cm.systemcity.manager.CacheManager;
import com.cm.systemcity.service.community.ICommunityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
/**
@ -36,6 +40,10 @@ public class ApplicationStartUp implements ApplicationRunner {
private RestTemplateUtil restTemplateUtil;
@Autowired
private IConfigDao configDao;
@Autowired
private ICommunityService communityService;
@Autowired
private MongoTemplate mongoTemplate;
@Override
public void run(ApplicationArguments args) throws Exception {
@ -46,6 +54,15 @@ public class ApplicationStartUp implements ApplicationRunner {
clientTokenManager.setRestTemplateUtil(restTemplateUtil);
clientTokenManager.setOauthProperties(oauthProperties);
clientTokenManager.setOauthClientProperties(oauthClientProperties);
// 项目重新启动时清除首页左侧片区树节点信息
mongoTemplate.remove(new Query(), MongoCollections.LIST_AREA_TREE.getCollection());
// 项目重新启动时清楚首页左侧人员点位树节点信息
mongoTemplate.remove(new Query(), MongoCollections.LIST_USER_EASYUI_TREE.getCollection());
// 将行政区划信息保存到缓存中
communityService.initAreaToMongo();
// 将村社区信息保存到缓存中
communityService.initCommunityToMongo();
}
}

View File

@ -74,10 +74,10 @@ public class AppOutOfContactTask {
final String dateTimeFormatter = "yyyy-MM-dd HH:mm:ss";
String currentDate = DateUtil.getDay();
DateTime now = DateTime.now();
DateTime amStartWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("amStartWorkTime").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime amEndWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("amEndWorkTime").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime pmStartWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("pmStartWorkTime").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime pmEndWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("pmEndWorkTime").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime amStartWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("signInEnd").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime amEndWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("positionRecordStr").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime pmStartWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("positionRecordEnd").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
DateTime pmEndWorkTime = DateTime.parse(String.format("%s %s", currentDate, config.get("signOutStr").toString()), DateTimeFormat.forPattern(dateTimeFormatter));
String amPm = DateUtil.getAmPm();
if (StringUtils.equalsIgnoreCase(DateUtil.AM, amPm)) {
if (!(now.isAfter(amStartWorkTime) && now.isBefore(amEndWorkTime))) {

View File

@ -63,4 +63,28 @@
LIMIT 1
</select>
<!-- ================= 查询部门表相关数据 ============================= -->
<resultMap id="departmentSortDTO" type="com.cm.common.pojo.dtos.department.DepartmentSortDTO">
<id property="departmentId" column="department_id"/>
<result property="departmentParentId" column="department_parent_id"/>
<result property="departmentName" column="department_name"/>
<result property="departmentCode" column="department_code"/>
<result property="departmentType" column="department_type"/>
</resultMap>
<select id="listDepartmentForMainPanel" parameterType="map" resultMap="departmentSortDTO">
SELECT
t1.department_id,
t1.department_parent_id,
t1.department_name,
t1.department_code,
t1.department_type
FROM
sys_department t1
WHERE
t1.is_delete = '0'
AND t1.department_parent_id = '0'
ORDER BY t1.department_order ASC
</select>
</mapper>

View File

@ -319,7 +319,8 @@
top.dialog.close(loadLayerIndex);
});
},
// 初始化地区选择树
// 网格初始化
initAreaTree: function() {
var self = this;
$('#areaTree').tree({
@ -368,6 +369,7 @@
}
});
},
// 查看案件流程
caseFlow: function(id) {
top.dialog.open({
@ -378,6 +380,7 @@
onClose: function() {}
});
},
// 初始化案件类别
initCaseTypeTree: function() {
var self = this;
@ -430,6 +433,7 @@
}
});
},
// 打开人员定位
openUserLocus: function(data) {
top.dialog.open({
@ -440,6 +444,7 @@
onClose: function() {}
})
},
// 初始化人员树
initPersonTree: function() {
var self = this;
@ -518,7 +523,7 @@
lat: item.userLatitude
});
// 描点
self.map.getBaiduMap().addOverlay(markWithUserAvatarAndUserName(self.map.getBaiduMap(), new BMap.Point(item.userLongitude, item.userLatitude), {
self.map.getMap().addOverlay(markWithUserAvatarAndUserName(self.map.getMap(), new BMap.Point(item.userLongitude, item.userLatitude), {
id: item.creator,
name: item.userName,
phone: item.userPhone,
@ -538,7 +543,7 @@
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
//loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
@ -573,6 +578,7 @@
var self = this;
self.map.map.setViewport(points);
}
},
mounted: function() {
top.Mask.hideMask();
@ -612,6 +618,197 @@
});
}
});
/**
* 标记用户,包括头像,用户名等
* @param map
* @param point
* @param avatar
* @param name
* @param phone
* @param explainText
* @param user
* @param callback
* @returns {UserAvatarAndUserName}
*/
function markWithUserAvatarAndUserName(map, point, user, explainText, callback) {
function UserAvatarAndUserName(map, point, user, explainText) {
this.baiduMap = map;
this.point = point;
this.user = user;
this.explainText = explainText;
this.isFocus = false;
}
UserAvatarAndUserName.prototype = new BMap.Overlay();
UserAvatarAndUserName.prototype.focusStyle = function() {
var self = this;
var userInfoBox = self.userInfoBox;
userInfoBox.oldZIndex = userInfoBox.style.zIndex;
userInfoBox.style.zIndex = '10000';
userInfoBox.style.cursor = 'pointer';
userInfoBox.style.width = '280px';
userInfoBox.style.height = '65px';
userInfoBox.style.top = (parseInt(userInfoBox.style.top.substring(0, userInfoBox.style.top.length - 2)) - 15) +'px';
self.arrow.style.top = (parseInt(self.arrow.style.top.substring(0, self.arrow.style.top.length - 2)) + 15) +'px';
self.arrowBottomBig.style.top = (parseInt(self.arrowBottomBig.style.top.substring(0, self.arrowBottomBig.style.top.length - 2)) + 15) +'px';
self.userExplainText.style.display = 'block';
};
UserAvatarAndUserName.prototype.unFocusStyle = function() {
var self = this;
var userInfoBox = self.userInfoBox;
userInfoBox.style.zIndex = userInfoBox.oldZIndex;
userInfoBox.style.backgroundColor = 'green';
userInfoBox.style.cursor = 'grab';
userInfoBox.style.width = '200px';
userInfoBox.style.height = '50px';
userInfoBox.style.top = (parseInt(userInfoBox.style.top.substring(0, userInfoBox.style.top.length - 2)) + 15) +'px';
self.arrow.style.top = (parseInt(self.arrow.style.top.substring(0, self.arrow.style.top.length - 2)) - 15) +'px';
self.arrowBottomBig.style.top = (parseInt(self.arrowBottomBig.style.top.substring(0, self.arrowBottomBig.style.top.length - 2)) - 15) +'px';
self.userExplainText.style.display = 'none';
};
UserAvatarAndUserName.prototype.initialize = function () {
var self = this;
var userInfoBox = this.userInfoBox = document.createElement('div');
userInfoBox.style.position = 'absolute';
userInfoBox.style.zIndex = BMap.Overlay.getZIndex(this.point.lat);
userInfoBox.style.backgroundColor = 'green';
userInfoBox.style.border = '1px solid white';
userInfoBox.style.width = '200px';
userInfoBox.style.height = '50px';
userInfoBox.style.borderRadius = '25px';
var userAvatar = this.userAvatar = document.createElement('img');
userAvatar.style.width = '40px';
userAvatar.style.height = '40px';
userAvatar.style.margin = '5px';
userAvatar.style.backgroundColor = 'white';
userAvatar.style.borderRadius = '20px';
if (user.avatar == '') {
userAvatar.setAttribute('src', 'assets/images/profile-photo.jpg');
} else {
userAvatar.setAttribute('src', 'route/file/downloadfile/true/' + user.avatar);
}
userAvatar.onclick = function() {
top.DialogBox.open({
url: top.restAjax.path('route/userlocation/get-user-detail.html?userId={userId}', [self.user.id]),
title: '人员详情',
width: '400px',
height: '365px',
onClose: function() {}
})
window.event? window.event.cancelBubble = true : e.stopPropagation();
}
userInfoBox.appendChild(userAvatar);
var infoBox = this.infoBox = document.createElement('div');
infoBox.setAttribute('class', 'info-box');
infoBox.style.display = 'inline-block';
infoBox.style.verticalAlign = 'middle';
infoBox.style.color = 'white';
infoBox.style.width = '65%';
userInfoBox.appendChild(infoBox)
var userName = this.userName = document.createElement('span');
userName.setAttribute('class', 'user-name');
userName.style.display = 'block';
userName.style.width = '100%';
userName.style.overflow = 'hidden';
userName.style.textOverflow = 'ellipsis';
userName.style.whiteSpace = 'nowrap';
userName.appendChild(document.createTextNode('姓名: ' + this.user.name));
infoBox.appendChild(userName);
var userPhone = this.userPhone = document.createElement('span');
userPhone.setAttribute('class', 'user-phone');
userPhone.style.display = 'block';
userPhone.style.width = '100%';
userPhone.style.overflow = 'hidden';
userPhone.style.textOverflow = 'ellipsis';
userPhone.style.whiteSpace = 'nowrap';
userPhone.appendChild(document.createTextNode('电话: ' + this.user.phone));
infoBox.appendChild(userPhone);
var userExplainText = this.userExplainText = document.createElement('div');
userExplainText.setAttribute('class', 'user-explain-text');
userExplainText.style.display = 'none';
userExplainText.style.width = '210px';
userExplainText.appendChild(document.createTextNode(this.explainText));
infoBox.appendChild(userExplainText);
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 = '48px';
arrow.style.left = '20px';
arrow.style.overflow = 'hidden';
userInfoBox.appendChild(arrow);
var arrowBottomBig = this.arrowBottomBig = document.createElement('div');
arrowBottomBig.setAttribute('class', 'arrow-bottom-big');
arrowBottomBig.style.position = 'absolute';
arrowBottomBig.style.width = '30px';
arrowBottomBig.style.height = '12px';
arrowBottomBig.style.margin = '0';
arrowBottomBig.style.border = '1px solid green';
arrowBottomBig.style.borderRadius = '50% / 50%';
arrowBottomBig.style.top = '50px';
arrowBottomBig.style.left = '15px';
userInfoBox.appendChild(arrowBottomBig);
var arrowBottomSmall = this.arrowBottomSmall = document.createElement('div');
arrowBottomSmall.setAttribute('class', 'arrow-bottom-small');
arrowBottomSmall.style.width = '20px';
arrowBottomSmall.style.height = '8px';
arrowBottomSmall.style.margin = '1px 4px 0 4px';
arrowBottomSmall.style.border = '1px solid green';
arrowBottomSmall.style.borderRadius = '50% / 50%';
arrowBottomBig.appendChild(arrowBottomSmall);
userInfoBox.onmouseover = function () {
if(!self.isFocus) {
self.focusStyle();
self.isFocus = true;
}
}
userInfoBox.onmouseout = function () {
if(self.isFocus) {
self.unFocusStyle();
self.isFocus = false;
}
};
userInfoBox.onclick = function (e) {
if (typeof (callback) == 'function') {
callback(user, e);
}
}
this.baiduMap.getPanes().labelPane.appendChild(userInfoBox);
return userInfoBox;
}
UserAvatarAndUserName.prototype.draw = function () {
var pixel = this.baiduMap.pointToOverlayPixel(this.point);
this.userInfoBox.style.left = pixel.x - parseInt(this.arrow.style.left) + 'px';
this.userInfoBox.style.top = pixel.y - 30 + 'px';
}
UserAvatarAndUserName.prototype.setFocus = function () {
if(!this.isFocus) {
this.focusStyle();
this.isFocus = true;
}
}
return new UserAvatarAndUserName(map, point, user, explainText);
}
</script>
</body>
</html>