From 8348de315973696ea8070aed065e7566d9155cb5 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Thu, 1 Feb 2024 16:09:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=90=9C=E7=B4=A2=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E6=A0=87=E7=AD=BE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datarelease/DataReleaseController.java | 465 +++++++++--------- .../dtos/communityboss/CommunityBossDTO.java | 2 + .../impl/AreaPointsServiceImpl.java | 63 ++- .../impl/CommunityBossServiceImpl.java | 12 + .../bindingdepartment-mapper.xml | 11 +- .../mapper/datarelease/datarelease-mapper.xml | 35 +- .../static/assets/js/baidu-map-0.0.1.min.js | 15 + .../route/userlocation/map_summary.html | 168 ++++++- 8 files changed, 516 insertions(+), 255 deletions(-) diff --git a/src/main/java/com/cm/systemcity/controller/datarelease/DataReleaseController.java b/src/main/java/com/cm/systemcity/controller/datarelease/DataReleaseController.java index 44db0e5..f7c9b60 100644 --- a/src/main/java/com/cm/systemcity/controller/datarelease/DataReleaseController.java +++ b/src/main/java/com/cm/systemcity/controller/datarelease/DataReleaseController.java @@ -48,6 +48,7 @@ import java.util.*; /** * 网格治理对外提供数据接口类 + * * @author xwangs * @create 2021-07-22 10:50 * @description @@ -82,10 +83,10 @@ public class DataReleaseController extends AbstractController { * 大数据网格详情页接口 */ @GetMapping("get-big-data-grid-detail") - public Map listBigDataGridDetail(){ + public Map listBigDataGridDetail() { Map query = requestParams(); Map res = new HashMap<>(8); - if(query.get("gridId") == null || "".equals(query.get("gridId").toString())){ + if (query.get("gridId") == null || "".equals(query.get("gridId").toString())) { return res; } String gridId = query.get("gridId").toString(); @@ -94,21 +95,21 @@ public class DataReleaseController extends AbstractController { res.put("gridInfo", gridDTO); // 查询网格内所有网格员或专管员 List> gridUserList = dataReleaseDao.listUserByGridId(gridId); - for(Map item : gridUserList){ + for (Map item : gridUserList) { // 判断用户是否为专管员 String userId = item.get("userId").toString(); Map roleObj = dataReleaseDao.getUserRoleForCheckNPerson(userId); item.put("deptOrCommunity", ""); item.put("reportCaseNum", "0"); item.put("handleCaseNum", "0"); - if(roleObj != null){ + if (roleObj != null) { // 专管员 List> usersDept = dataReleaseDao.listDepartmentByUserId(userId); String deptNames = ""; - for(Map deptItem : usersDept){ - if("".equals(deptNames)){ + for (Map deptItem : usersDept) { + if ("".equals(deptNames)) { deptNames += deptItem.get("departmentName").toString(); - } else{ + } else { deptNames += "," + deptItem.get("departmentName").toString(); } } @@ -125,10 +126,10 @@ public class DataReleaseController extends AbstractController { CommunityDTO community = communityService.getCommunity(query); String deptOrCommunity = ""; deptOrCommunity += communityBoss.getAreaName(); - if(community != null){ + if (community != null) { deptOrCommunity += "/" + community.getCommunityName(); } - item.put("deptOrCommunity", deptOrCommunity); + item.put("deptOrCommunity", deptOrCommunity); // 查询案件信息 query.put("creator", userId); List> listReport = dataReleaseDao.listReportCase(query); @@ -145,7 +146,7 @@ public class DataReleaseController extends AbstractController { * 大数据二级页面-地图大网格 */ @GetMapping("list-big-data-map-grid") - public List> listBigDataMapGrid(){ + public List> listBigDataMapGrid() { Map query = new HashMap<>(8); List> resList = new ArrayList<>(0); List gridIds = new ArrayList<>(0); @@ -157,17 +158,17 @@ public class DataReleaseController extends AbstractController { gridIds.add("6901b73b-7ace-4fd6-9977-20ec85166bbe"); // 希望工业园区网格(民馨路) gridIds.add("99bb2615-907e-466d-96c5-093b6ef3333a"); - for(String gridId : gridIds){ + for (String gridId : gridIds) { query.put("gridId", gridId); List> gridList = dataReleaseDao.listMapGrid(query); - for(Map grid : gridList){ + for (Map grid : gridList) { Map temp = new HashMap<>(8); temp.put("gridColor", grid.get("fill_color").toString()); temp.put("gridName", grid.get("grid_name").toString()); List> pointList = dataReleaseDao.listMapGridPoint(query); temp.put("gridPointList", pointList); - if(gridId.equals("9074df15-de5b-42d1-ae08-d8207b26a2d7") - || gridId.equals("cea3a6af-f67f-4cdf-9c50-a28479d72ac5")){ + if (gridId.equals("9074df15-de5b-42d1-ae08-d8207b26a2d7") + || gridId.equals("cea3a6af-f67f-4cdf-9c50-a28479d72ac5")) { // 案件数-万水泉 query.put("areaId", "8d62a0cc-2c15-4355-906c-6720f8f3617e"); List> reportCaseList = dataReleaseDao.listReportCase(query); @@ -186,7 +187,7 @@ public class DataReleaseController extends AbstractController { temp.put("populationCount", populationCount); resList.add(temp); } - if(gridId.equals("6901b73b-7ace-4fd6-9977-20ec85166bbe")){ + if (gridId.equals("6901b73b-7ace-4fd6-9977-20ec85166bbe")) { // 案件数-稀土 query.put("areaId", "7ed23f06-566d-43b7-acd9-4f0b5db08974"); List> reportCaseList = dataReleaseDao.listReportCase(query); @@ -205,7 +206,7 @@ public class DataReleaseController extends AbstractController { temp.put("populationCount", populationCount); resList.add(temp); } - if(gridId.equals("99bb2615-907e-466d-96c5-093b6ef3333a")){ + if (gridId.equals("99bb2615-907e-466d-96c5-093b6ef3333a")) { // 案件数-民馨 query.put("areaId", "6e922367-f21f-4daf-b38c-c55a67d9a35b"); List> reportCaseList = dataReleaseDao.listReportCase(query); @@ -228,24 +229,25 @@ public class DataReleaseController extends AbstractController { } return resList; } + /** * 大数据地图二级页面-定位-查询当日人员定位 */ @GetMapping("list-user-location") - public List> listUserLocation(){ + public List> listUserLocation() { Map query = requestParams(); - if(query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())){ + if (query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())) { return new ArrayList<>(0); } List> resList = new ArrayList<>(0); String nodeIdStr = query.get("nodeIds").toString(); String[] nodeIds = nodeIdStr.split(","); - for(String userId : nodeIds){ + for (String userId : nodeIds) { query.put("userId", userId); Map location = dataReleaseDao.getLastUserLocationInfo(query); - if(location != null){ + if (location != null) { Map temp = new HashMap<>(8); - temp.put("lastPointTime", location.get("gmt_create").toString().substring(0,19)); + temp.put("lastPointTime", location.get("gmt_create").toString().substring(0, 19)); temp.put("lng", location.get("user_longitude").toString()); temp.put("lat", location.get("user_latitude").toString()); temp.put("userName", location.get("user_name").toString()); @@ -262,9 +264,9 @@ public class DataReleaseController extends AbstractController { * 大数据地图二级页面-点击案件类型获取案件点位地点等信息 */ @GetMapping("list-report-info-by-case-id") - public List> listReportInfoByCaseId(){ + public List> listReportInfoByCaseId() { Map query = requestParams(); - if(query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())){ + if (query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())) { return new ArrayList<>(0); } query.put("caseTypeId", query.get("nodeIds").toString()); @@ -272,13 +274,13 @@ public class DataReleaseController extends AbstractController { query.put("caseStatus", "2,3"); List> resList = new ArrayList<>(0); List> list = dataReleaseDao.listReportCase(query); - for(Map item : list){ - Map temp = new HashMap<>(8); + for (Map item : list) { + Map temp = new HashMap<>(8); temp.put("reportCaseId", item.get("report_case_id")); temp.put("text", item.get("case_content")); temp.put("lng", item.get("case_longitude")); temp.put("lat", item.get("case_latitude")); - temp.put("reportTime", item.get("gmt_create").toString().substring(0,19)); + temp.put("reportTime", item.get("gmt_create").toString().substring(0, 19)); temp.put("caseStatus", item.get("case_status")); temp.put("caseTypeName", item.get("case_type_name")); resList.add(temp); @@ -290,13 +292,13 @@ public class DataReleaseController extends AbstractController { * 大数据地图二级页面-案件类型树 */ @GetMapping("list-tree-all-case-type") - public List> listTreeAllCaseType(){ + public List> listTreeAllCaseType() { Map query = new HashMap<>(8); - List> resList= new ArrayList<>(0); + List> resList = new ArrayList<>(0); // 顶级节点 - query.put("dictParentId","46d108b2-4ef9-4f6f-b30c-0c700e3ee852"); + query.put("dictParentId", "46d108b2-4ef9-4f6f-b30c-0c700e3ee852"); List topList = dictService.listDict(query); - for(DictDTO item : topList){ + for (DictDTO item : topList) { Map topNode = new HashMap<>(8); topNode.put("lable", item.getDictName()); topNode.put("nodeTag", "top"); @@ -304,9 +306,9 @@ public class DataReleaseController extends AbstractController { List> caseTypeList = new ArrayList<>(0); topNode.put("children", caseTypeList); // 查询案件子类型列表 - query.put("dictParentId",item.getDictId()); + query.put("dictParentId", item.getDictId()); List childrenList = dictService.listDict(query); - for(DictDTO children : childrenList){ + for (DictDTO children : childrenList) { Map childrenNode = new HashMap<>(8); childrenNode.put("nodeTag", "caseType"); childrenNode.put("nodeId", children.getDictId()); @@ -323,18 +325,19 @@ public class DataReleaseController extends AbstractController { * 大数据地图二级页面-点击节点查询网格 */ @GetMapping("list-map-grid") - public List> listMapGrid(){ + public List> listMapGrid() { List> mapGridResult = new ArrayList<>(0); String street = "street"; String community = "community"; String dept = "dept"; String user = "user"; + String gridTag = "grid"; Map query = requestParams(); Map param = new HashMap<>(8); // 如果没传该参数, 则返回大网格 - if(query.get("nodeTag") == null + if (query.get("nodeTag") == null || "top".equals(query.get("nodeTag").toString()) - || "".equals(query.get("nodeTag").toString())){ + || "".equals(query.get("nodeTag").toString())) { // 放入高新区大网格 List gridIds = new ArrayList<>(0); // 万水泉街道网格一 @@ -345,87 +348,56 @@ public class DataReleaseController extends AbstractController { gridIds.add("6901b73b-7ace-4fd6-9977-20ec85166bbe"); // 希望工业园区网格 gridIds.add("99bb2615-907e-466d-96c5-093b6ef3333a"); - for(String gridId : gridIds){ + for (String gridId : gridIds) { param.clear(); param.put("gridId", gridId); List> gridList = dataReleaseDao.listMapGrid(param); - for(Map grid : gridList){ - Map temp = new HashMap<>(8); - temp.put("gridId", grid.get("grid_id").toString()); - temp.put("gridName", grid.get("grid_name").toString()); - temp.put("gridColor", grid.get("fill_color").toString()); - // 放入当前网格的边界点 - param.put("gridId", grid.get("grid_id").toString()); - List> pointList = dataReleaseDao.listMapGridPoint(param); - temp.put("gridPointList", pointList); - mapGridResult.add(temp); - } + setGrid(mapGridResult, gridList); } return mapGridResult; } String nodeTag = query.get("nodeTag").toString(); // 点击街道 - if(street.equals(nodeTag)){ + if (street.equals(nodeTag)) { String nodeId; try { nodeId = query.get("nodeId").toString(); - } catch (Exception e){ + } catch (Exception e) { // 没传ID返回空内容 return mapGridResult; } param.put("areaId", nodeId); List communityList = communityService.listCommunity(param); - for (CommunityDTO item : communityList){ + for (CommunityDTO item : communityList) { param.clear(); param.put("areaCode", item.getCommunityId()); // 到map_grid表中查询网格 List> gridList = dataReleaseDao.listMapGrid(param); - for(Map grid : gridList){ - Map temp = new HashMap<>(8); - temp.put("gridId", grid.get("grid_id").toString()); - temp.put("gridName", grid.get("grid_name").toString()); - temp.put("gridColor", grid.get("fill_color").toString()); - // 放入当前网格的边界点 。。。。 - param.put("gridId", grid.get("grid_id").toString()); - List> pointList = dataReleaseDao.listMapGridPoint(param); - temp.put("gridPointList", pointList); - mapGridResult.add(temp); - } + setGrid(mapGridResult, gridList); } return mapGridResult; } // 点击社区 - if(community.equals(nodeTag)){ + if (community.equals(nodeTag)) { String nodeId; try { nodeId = query.get("nodeId").toString(); - } catch (Exception e){ + } catch (Exception e) { // 没传ID返回空内容 return mapGridResult; } param.put("areaCode", nodeId); // 到map_grid表中查询网格 List> gridList = dataReleaseDao.listMapGrid(param); - for(Map grid : gridList){ - param.clear(); - Map temp = new HashMap<>(8); - temp.put("gridId", grid.get("grid_id").toString()); - temp.put("gridName", grid.get("grid_name").toString()); - temp.put("gridColor", grid.get("fill_color").toString()); - // 放入当前网格的边界点 - param.put("gridId", grid.get("grid_id").toString()); - List> pointList = dataReleaseDao.listMapGridPoint(param); - temp.put("gridPointList", pointList); - mapGridResult.add(temp); - } + setGrid(mapGridResult, gridList); return mapGridResult; } // 点击部门 - if(dept.equals(nodeTag)){ + if (dept.equals(nodeTag)) { String nodeId; try { nodeId = query.get("nodeId").toString(); - } catch (Exception e){ + } catch (Exception e) { // 没传ID返回空内容 return mapGridResult; } @@ -436,67 +408,87 @@ public class DataReleaseController extends AbstractController { // 需要根据专管单位名称查询sys_department表中的部门ID, 根据部门ID取到该部门下所有专管员的所有网格 param.put("communityName", deptName); List> communityInfo = dataReleaseDao.getCommunityInfo(param); - for (Map item : communityInfo){ + for (Map item : communityInfo) { param.clear(); String communityId = item.get("community_id").toString(); param.put("areaCode", communityId); // 到map_grid表中查询网格 List> gridList = dataReleaseDao.listMapGrid(param); - for(Map grid : gridList){ - Map temp = new HashMap<>(8); - temp.put("gridId", grid.get("grid_id").toString()); - temp.put("gridName", grid.get("grid_name").toString()); - temp.put("gridColor", grid.get("fill_color").toString()); - // 放入当前网格的边界点 - param.put("gridId", grid.get("grid_id").toString()); - List> pointList = dataReleaseDao.listMapGridPoint(param); - temp.put("gridPointList", pointList); - mapGridResult.add(temp); - } + setGrid(mapGridResult, gridList); } return mapGridResult; } // 点击用户 - if(user.equals(nodeTag)){ + if (user.equals(nodeTag)) { String nodeId; try { nodeId = query.get("nodeId").toString(); - } catch (Exception e){ + } catch (Exception e) { // 没传ID返回空内容 return mapGridResult; } param.put("relationId", nodeId); List> relationList = dataReleaseDao.listMapGridRelation(param); - for(Map relation : relationList){ + for (Map relation : relationList) { param.clear(); String gridId = relation.get("grid_id").toString(); param.put("gridId", gridId); List> gridList = dataReleaseDao.listMapGrid(param); - for(Map grid : gridList){ - Map temp = new HashMap<>(8); - temp.put("gridId", grid.get("grid_id").toString()); - temp.put("gridName", grid.get("grid_name").toString()); - temp.put("gridColor", grid.get("fill_color").toString()); - // 放入当前网格的边界点 - param.put("gridId", grid.get("grid_id").toString()); - List> pointList = dataReleaseDao.listMapGridPoint(param); - temp.put("gridPointList", pointList); - mapGridResult.add(temp); - } + setGrid(mapGridResult, gridList); } return mapGridResult; } + // 点击网格 + if (gridTag.equals(nodeTag)) { + String nodeId; + try { + nodeId = query.get("nodeId").toString(); + } catch (Exception e) { + // 没传ID返回空内容 + return mapGridResult; + } + Map params = new HashMap<>(); + params.put("gridId", nodeId); + List> gridList = dataReleaseDao.listMapGrid(params); + setGrid(mapGridResult, gridList); + } return mapGridResult; } + @GetMapping("list-map-grid-search") + public List> listMapGrid(@RequestParam("keywords") String keywords) { + List> mapGridResult = new ArrayList<>(0); + Map params = new HashMap<>(2); + params.put("keywords", keywords); + List> gridList = dataReleaseDao.listMapGrid(params); + setGrid(mapGridResult, gridList); + return mapGridResult; + } + + private void setGrid(List> mapGridResult, List> gridList) { + Map params = new HashMap<>(); + for (Map grid : gridList) { + Map temp = new HashMap<>(8); + temp.put("gridId", grid.get("grid_id").toString()); + temp.put("gridName", grid.get("grid_name").toString()); + temp.put("gridColor", grid.get("fill_color").toString()); + // 放入当前网格的边界点 + params.put("gridId", grid.get("grid_id").toString()); + List> pointList = dataReleaseDao.listMapGridPoint(params); + temp.put("gridPointList", pointList); + mapGridResult.add(temp); + } + } + /** * 大数据地图二级页面-网格-专管单位 + * * @return */ @GetMapping("list-tree-all-dept-grid") - public List> listTreeAllDeptGrid(){ + public List> listTreeAllDeptGrid() { Map query = requestParams(); - List> resList= new ArrayList<>(0); + List> resList = new ArrayList<>(0); // 顶级节点 Map topNode = new HashMap<>(8); topNode.put("nodeTag", "top"); @@ -506,7 +498,7 @@ public class DataReleaseController extends AbstractController { topNode.put("children", deptNodeList); // 专管单位节点 List departmentSortDTOs = bindingDepartmentService.listDepartmentForMainPanel(query); - for(DepartmentSortDTO item : departmentSortDTOs){ + for (DepartmentSortDTO item : departmentSortDTOs) { Map deptNode = new HashMap<>(8); deptNode.put("nodeTag", "dept"); deptNode.put("nodeId", item.getDepartmentId()); @@ -517,7 +509,7 @@ public class DataReleaseController extends AbstractController { // 查询专管员 query.put("departmentId", item.getDepartmentId()); List> userList = bindingDepartmentService.listNPerson(query); - for(Map user : userList){ + for (Map user : userList) { Map userNode = new HashMap<>(8); userNode.put("nodeId", user.get("userId") == null ? "缺失" : user.get("userId").toString()); userNode.put("lable", user.get("userName") == null ? "缺失" : user.get("userName").toString()); @@ -532,12 +524,13 @@ public class DataReleaseController extends AbstractController { /** * 大数据地图二级页面-网格-所有网格 + * * @return */ @GetMapping("list-tree-all-normal-grid") - public List> listTreeAllNormalGrid(){ + public List> listTreeAllNormalGrid() { Map query = requestParams(); - List> resList= new ArrayList<>(0); + List> resList = new ArrayList<>(0); // 顶级节点 Map topNode = new HashMap<>(8); topNode.put("lable", "所有网格"); @@ -548,9 +541,9 @@ public class DataReleaseController extends AbstractController { // 街道节点 query.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c"); List streetList = dictService.listDict(query); - for(DictDTO item : streetList){ + for (DictDTO item : streetList) { String dictName = item.getDictName(); - if("专管员区域".equals(dictName)){ + if ("专管员区域".equals(dictName)) { continue; } Map streetNode = new HashMap<>(8); @@ -563,7 +556,7 @@ public class DataReleaseController extends AbstractController { // 社区节点 query.put("areaId", item.getDictId()); List communityDTOS = communityService.listCommunity(query); - for(CommunityDTO item2 : communityDTOS){ + for (CommunityDTO item2 : communityDTOS) { Map communityNode = new HashMap<>(8); communityNode.put("lable", item2.getCommunityName()); communityNode.put("nodeTag", "community"); @@ -574,7 +567,7 @@ public class DataReleaseController extends AbstractController { // 查询网格员 query.put("communityId", item2.getCommunityId()); List gridUser = communityBossService.listGridUser(query); - for(CommunityBossDTO user : gridUser){ + for (CommunityBossDTO user : gridUser) { Map userNode = new HashMap<>(8); userNode.put("lable", user.getCommunityBossName()); userNode.put("nodeTag", "user"); @@ -591,7 +584,7 @@ public class DataReleaseController extends AbstractController { } @GetMapping("repair-data") - public void repairData(){ + public void repairData() { // 更新地图左侧人员树缓存 mongoTemplate.remove(new Query(), "INDEX_PANEL_GRID_TREE"); } @@ -599,10 +592,10 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "案件情况-数量", notes = "案件情况-数量") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-case-report-count-info") - public BigDataResult getCaseReportCountInfo(){ - Map reqParams = requestParams(); + public BigDataResult getCaseReportCountInfo() { + Map reqParams = requestParams(); // 判断获取哪类案件的标识 - if(reqParams.get("dataCatalog") == null && reqParams.get("dataCatalog").toString().length() == 0){ + if (reqParams.get("dataCatalog") == null && reqParams.get("dataCatalog").toString().length() == 0) { return new BigDataResult(); } String dataCatalog = reqParams.get("dataCatalog").toString(); @@ -611,60 +604,60 @@ public class DataReleaseController extends AbstractController { BigDataResult bdr = new BigDataResult(); Map query = new HashMap<>(8); Map bdrData = new HashMap<>(8); - bdrData.put("value",0); - bdrData.put("type","up"); - bdrData.put("percentage","0"); - String nowMonth = DateUtil.getDay().substring(0,7); + bdrData.put("value", 0); + bdrData.put("type", "up"); + bdrData.put("percentage", "0"); + String nowMonth = DateUtil.getDay().substring(0, 7); String lastMonth = bdr.lastMonth(); - query.put("caseStatus","6"); - query.put("dataCatalog",dataCatalog); - switch (dataCatalog){ - case "dept" : + query.put("caseStatus", "6"); + query.put("dataCatalog", dataCatalog); + switch (dataCatalog) { + case "dept": List> deptList = dataReleaseDao.listReportCase(query); - bdrData.put("value",deptList.size()); + bdrData.put("value", deptList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> lastMonthList = dataReleaseDao.listReportCase(query); - bdrData.put("type" ,nowMonthList.size() - lastMonthList.size() >= 0 ? "up" : "down"); + bdrData.put("type", nowMonthList.size() - lastMonthList.size() >= 0 ? "up" : "down"); bdrData.put("percentage", Math.abs(nowMonthList.size() - lastMonthList.size()) + "件"); break; - case "street" : + case "street": List> streetList = dataReleaseDao.listReportCase(query); - bdrData.put("value",streetList.size()); + bdrData.put("value", streetList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthStreetList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> lastMonthStreetList = dataReleaseDao.listReportCase(query); - bdrData.put("type" ,nowMonthStreetList.size() - lastMonthStreetList.size() >= 0 ? "up" : "down"); + bdrData.put("type", nowMonthStreetList.size() - lastMonthStreetList.size() >= 0 ? "up" : "down"); bdrData.put("percentage", Math.abs(nowMonthStreetList.size() - lastMonthStreetList.size()) + "件"); break; - case "person" : + case "person": List> personList = dataReleaseDao.listReportCase(query); - bdrData.put("value",personList.size()); + bdrData.put("value", personList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthPersonList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> lastMonthPersonList = dataReleaseDao.listReportCase(query); - bdrData.put("type" ,nowMonthPersonList.size() - lastMonthPersonList.size() >= 0 ? "up" : "down"); + bdrData.put("type", nowMonthPersonList.size() - lastMonthPersonList.size() >= 0 ? "up" : "down"); bdrData.put("percentage", Math.abs(nowMonthPersonList.size() - lastMonthPersonList.size()) + "件"); break; - case "special" : + case "special": List> specialList = dataReleaseDao.listSpecialReportCase(query); - bdrData.put("value",specialList.size()); + bdrData.put("value", specialList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthSpecialList = dataReleaseDao.listSpecialReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> lastMonthSpecialList = dataReleaseDao.listSpecialReportCase(query); - bdrData.put("type" ,nowMonthSpecialList.size() - lastMonthSpecialList.size() >= 0 ? "up" : "down"); + bdrData.put("type", nowMonthSpecialList.size() - lastMonthSpecialList.size() >= 0 ? "up" : "down"); bdrData.put("percentage", Math.abs(nowMonthSpecialList.size() - lastMonthSpecialList.size()) + "件"); break; default: @@ -677,26 +670,26 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "各区域案件占比-包含特殊案件量", notes = "各区域案件占比-包含特殊案件量") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-community-report-case") - public BigDataResult getCommunityReportCase(){ + public BigDataResult getCommunityReportCase() { // {data:{},list:[{name:'万水泉镇',value:300},{name:'民馨路',value:1200},{name:'稀土路',value:3600}],msg:'加载成功',state:'200'} - Map reqParams = requestParams(); - reqParams.put("dictParentId","9d179f05-3ea0-48f7-853c-d3b7124b791c"); + Map reqParams = requestParams(); + reqParams.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c"); List dictDTOS = dictService.listDict(reqParams); - if(dictDTOS == null || dictDTOS.size() == 0){ + if (dictDTOS == null || dictDTOS.size() == 0) { return new BigDataResult(); } List> resList = new ArrayList<>(); - for(DictDTO dictItem : dictDTOS){ + for (DictDTO dictItem : dictDTOS) { reqParams.clear(); Map resItem = new HashMap<>(8); - resItem.put("name",dictItem.getDictName()); + resItem.put("name", dictItem.getDictName()); // 查询该街镇下所有普通案件 已完结 reqParams.put("caseStatus", "6"); - reqParams.put("areaId",dictItem.getDictId()); + reqParams.put("areaId", dictItem.getDictId()); List> normalList = dataReleaseDao.listReportCase(reqParams); // 查询该街镇下所有特殊案件 /*List> specialList = dataReleaseDao.listSpecialReportCase(reqParams);*/ - resItem.put("value",normalList.size()); + resItem.put("value", normalList.size()); resList.add(resItem); } BigDataResult bdr = new BigDataResult(); @@ -707,27 +700,27 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "案件类型TOP10", notes = "案件类型TOP10") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-case-type-top10") - public BigDataResult getCaseTypeTop10(){ + public BigDataResult getCaseTypeTop10() { // {data:{nameColumns:['案件数量']},list:[{name:'餐厨垃圾',columns:[3]},{name:'污水管网及井盖养护',columns:[0]},{name:'暂住人口问题',columns:[5]}, // {name:'道路交通设施',columns:[5]},{name:'人行道维修养护',columns:[25]}],msg:'加载成功',state:'200'} - Map reqParams = requestParams(); + Map reqParams = requestParams(); List> caseTypeList = dataReleaseDao.getCaseTypeTop10(reqParams); - if(caseTypeList == null || caseTypeList.size() == 0){ + if (caseTypeList == null || caseTypeList.size() == 0) { return new BigDataResult(); } List> resList = new ArrayList<>(); - for(Map caseTypeItem : caseTypeList){ + for (Map caseTypeItem : caseTypeList) { Map resItem = new HashMap<>(8); - resItem.put("name",caseTypeItem.get("dictName").toString()); + resItem.put("name", caseTypeItem.get("dictName").toString()); List columnsList = new ArrayList<>(); columnsList.add(Integer.parseInt(caseTypeItem.get("caseTypeCount").toString())); - resItem.put("columns",columnsList); - resItem.put("caseTypeId",caseTypeItem.get("caseTypeId")); + resItem.put("columns", columnsList); + resItem.put("caseTypeId", caseTypeItem.get("caseTypeId")); resList.add(resItem); } BigDataResult bdr = new BigDataResult(); Map resData = new HashMap<>(4); - resData.put("nameColumns","案件数量"); + resData.put("nameColumns", "案件数量"); bdr.setData(resData); bdr.setList(resList); return bdr; @@ -736,17 +729,17 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "7日案件进展情况", notes = "7日案件进展情况") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-7day-report-case") - public BigDataResult get7DayReportCase(){ - Map reqParams = requestParams(); + public BigDataResult get7DayReportCase() { + Map reqParams = requestParams(); // 为了避免案件类型没传,单独处理 - if(reqParams.get("caseFlowType") == null || "".equals(reqParams.get("caseFlowType").toString().trim())){ + if (reqParams.get("caseFlowType") == null || "".equals(reqParams.get("caseFlowType").toString().trim())) { reqParams.put("caseFlowType", "1,2"); } List> resList = new ArrayList<>(); Map itemMap; String nowDate = DateUtil.getDay(); - String last7Date = DateUtil.getBeforeDate(6,"yyyy-MM-dd"); - reqParams.put("startTime",last7Date + " 00:00:00"); + String last7Date = DateUtil.getBeforeDate(6, "yyyy-MM-dd"); + reqParams.put("startTime", last7Date + " 00:00:00"); reqParams.put("endTime", nowDate + " 23:59:59"); // 受理 /*reqParams.put("caseStatusCompareUp","1"); @@ -763,28 +756,28 @@ public class DataReleaseController extends AbstractController { itemMap.put("value", list2 == null ? 0 : list2.size()); resList.add(itemMap);*/ // 待下中 - reqParams.put("caseStatus","2"); + reqParams.put("caseStatus", "2"); List> list3 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "下派中"); itemMap.put("value", list3 == null ? 0 : list3.size()); resList.add(itemMap); // 处理 - reqParams.put("caseStatus","3"); + reqParams.put("caseStatus", "3"); List> list4 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "处理中"); itemMap.put("value", list4 == null ? 0 : list4.size()); resList.add(itemMap); // 检查 - reqParams.put("caseStatus","4"); + reqParams.put("caseStatus", "4"); List> list5 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "检查中"); itemMap.put("value", list5 == null ? 0 : list5.size()); resList.add(itemMap); // 归档 - reqParams.put("caseStatus","6"); + reqParams.put("caseStatus", "6"); List> list6 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "已归档"); @@ -798,33 +791,33 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "案件处理满意度", notes = "案件处理满意度") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-grade-ratio") - public BigDataResult getGradeRatio(){ - Map reqParams = requestParams(); + public BigDataResult getGradeRatio() { + Map reqParams = requestParams(); BigDataResult bdr = new BigDataResult(); // {data:{value:96.5},list:[],msg:'加载成功',state:'200'} - reqParams.put("caseStatus","6"); + reqParams.put("caseStatus", "6"); List> gradeList = dataReleaseDao.listReportCase(reqParams); - if(gradeList == null || gradeList.size() == 0){ + if (gradeList == null || gradeList.size() == 0) { return new BigDataResult(); } Integer totalGrade = gradeList.size() * 5; Integer nowGrade = 0; - for (Map gradeItem : gradeList){ - if(gradeItem.get("grade") == null + for (Map gradeItem : gradeList) { + if (gradeItem.get("grade") == null || "".equals(gradeItem.get("grade").toString()) || "null".equals(gradeItem.get("grade").toString()) || "0".equals(gradeItem.get("grade").toString()) - ){ + ) { nowGrade += 3; } else { nowGrade += Integer.parseInt(gradeItem.get("grade").toString()); } } - BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100) - .setScale(2,BigDecimal.ROUND_HALF_UP); - //bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2); + BigDecimal ratioBigDecimal = new BigDecimal((nowGrade.doubleValue() / totalGrade.doubleValue()) * 100) + .setScale(2, BigDecimal.ROUND_HALF_UP); + //bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2); Map resData = new HashMap<>(4); - resData.put("value",ratioBigDecimal.doubleValue()); + resData.put("value", ratioBigDecimal.doubleValue()); bdr.setData(resData); return bdr; } @@ -832,34 +825,34 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "案件满意度二级列表", notes = "案件满意度二级列表") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("list-grade-ratio") - public SuccessResultList>> listGradeRatio(){ - Map params = requestParams(); - params.put("caseStatus","6"); + public SuccessResultList>> listGradeRatio() { + Map params = requestParams(); + params.put("caseStatus", "6"); List> gradeList = dataReleaseDao.listReportCase(params); Integer totalGrade = 0; Integer nowGrade = 0; totalGrade = gradeList.size() * 5; - for(Map item : gradeList){ - item.put("gmt_create", item.get("gmt_create").toString().substring(0,19)); - if(item.get("grade") == null + for (Map item : gradeList) { + item.put("gmt_create", item.get("gmt_create").toString().substring(0, 19)); + if (item.get("grade") == null || "0".equals(item.get("grade").toString()) - || "".equals(item.get("grade").toString())){ + || "".equals(item.get("grade").toString())) { nowGrade += 3; } else { nowGrade += Integer.parseInt(item.get("grade").toString()); } } - if(totalGrade == 0){ + if (totalGrade == 0) { return new SuccessResultList<>(new ArrayList<>(), 1, 0L); } Map totalInfoMap = new HashMap<>(8); totalInfoMap.put("case_reporter", "合计: " + gradeList.size() + "件"); - BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100) - .setScale(2,BigDecimal.ROUND_HALF_UP); + BigDecimal ratioBigDecimal = new BigDecimal((nowGrade.doubleValue() / totalGrade.doubleValue()) * 100) + .setScale(2, BigDecimal.ROUND_HALF_UP); totalInfoMap.put("grade", "总体满意度: " + ratioBigDecimal.doubleValue()); List> resList = new LinkedList<>(); resList.add(totalInfoMap); - for(Map item : gradeList){ + for (Map item : gradeList) { resList.add(item); } return new SuccessResultList<>(resList, 1, 0L); @@ -868,30 +861,30 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "各月份案件情况统计", notes = "各月份案件情况统计") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-month-report-case") - public BigDataResult getMonthReportCase(){ - Map reqParams = requestParams(); + public BigDataResult getMonthReportCase() { + Map reqParams = requestParams(); BigDataResult bdr = new BigDataResult(); Integer year = Integer.parseInt(DateUtil.getYear()); Integer month; - if(DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0,1))){ + if (DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0, 1))) { month = Integer.parseInt(DateUtil.getMonth().replaceAll("0", "")); } else { month = Integer.parseInt(DateUtil.getMonth()); } List monthList = new ArrayList<>(); - for(int i = 0; i < 12; i++){ - if(month - i == 0){ + for (int i = 0; i < 12; i++) { + if (month - i == 0) { monthList.add((year - 1) + "-" + 12); continue; } - if(month - i < 0){ - monthList.add((year -1) + "-" + (12 + (month - i))); + if (month - i < 0) { + monthList.add((year - 1) + "-" + (12 + (month - i))); continue; } monthList.add(year + "-" + (month - i)); } List> resList = new ArrayList<>(); - for(String str : monthList){ + for (String str : monthList) { Map resMap = new HashMap<>(8); String queryTime = str.length() == 6 ? str.replace("-", "-0") : str; reqParams.put("gmtCreateLike", queryTime); @@ -907,19 +900,19 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "案件动态", notes = "案件动态") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-report-case-dynamic") - public BigDataResult getReportCaseDynamic(){ - Map reqParams = requestParams(); + public BigDataResult getReportCaseDynamic() { + Map reqParams = requestParams(); // {title:'万水泉 ',content:'村名王某因为被隔壁邻居的狗咬了,产生了纠纷,村名报警。',date:'2021-03-15'} // 默认查询10条 List> logList = dataReleaseDao.listReportCaseLog(reqParams); - if(logList == null || logList.size() == 0){ + if (logList == null || logList.size() == 0) { return new BigDataResult(); } List> resList = new ArrayList<>(); - for (Map logItem : logList){ + for (Map logItem : logList) { Map resData = new HashMap<>(8); resData.put("title", "【" + logItem.get("optionType").toString() + "】- " + logItem.get("userName").toString()); - resData.put("date", logItem.get("gmtCreate").toString().substring(0,19)); + resData.put("date", logItem.get("gmtCreate").toString().substring(0, 19)); resData.put("content", logItem.get("caseContent").toString()); resData.put("caseNumber", logItem.get("caseNumber").toString()); resList.add(resData); @@ -932,8 +925,8 @@ public class DataReleaseController extends AbstractController { @ApiOperation(value = "人员实时活跃情况", notes = "人员实时活跃情况") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get-user-dynamic-position") - public BigDataResult getUserDynamicPosition(){ - Map reqParams = requestParams(); + public BigDataResult getUserDynamicPosition() { + Map reqParams = requestParams(); Date nowData = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("HH"); String nowHour = sdf.format(nowData); @@ -943,20 +936,20 @@ public class DataReleaseController extends AbstractController { System.out.println(nowHour); List> resList = new ArrayList<>(); // 分割当前小时为6段 10分钟一段 统计活跃人数 最后一段统计59分59秒 - for(int i = 0; i < 6; i++){ + for (int i = 0; i < 6; i++) { Map resData = new HashMap<>(8); Map query = new HashMap<>(8); - if(i == 0){ - query.put("timeStr",nowDate + nowHour + ":00:00"); + if (i == 0) { + query.put("timeStr", nowDate + nowHour + ":00:00"); } else { - query.put("timeStr",nowDate + nowHour + ":" + (i * 10) + ":00"); + query.put("timeStr", nowDate + nowHour + ":" + (i * 10) + ":00"); } - if(i == 5){ - query.put("timeEnd",nowDate + nowHour + ":59:59"); + if (i == 5) { + query.put("timeEnd", nowDate + nowHour + ":59:59"); query.put("time", nowHour + ":59"); resData.put("time", nowHour + ":59"); } else { - query.put("timeEnd",nowDate + nowHour + ":" + (i + 1) * 10 + ":00"); + query.put("timeEnd", nowDate + nowHour + ":" + (i + 1) * 10 + ":00"); query.put("time", nowHour + ":" + (i + 1) * 10); resData.put("time", nowHour + ":" + (i + 1) * 10); } @@ -973,9 +966,9 @@ public class DataReleaseController extends AbstractController { * 查询街道信息 city_dict表 */ @GetMapping("get-area-info-city-dict") - public List> getAreaInfo(){ + public List> getAreaInfo() { Map param = requestParams(); - if(param.get("dictParentId") == null || "".equals(param.get("dictParentId").toString())){ + if (param.get("dictParentId") == null || "".equals(param.get("dictParentId").toString())) { return new ArrayList<>(0); } List> list = dataReleaseDao.getAreaInfoFromCityDict(param); @@ -986,9 +979,9 @@ public class DataReleaseController extends AbstractController { * 查询社区信息 city_community表 */ @GetMapping("get-community-info") - public List> getCommunityInfo(){ + public List> getCommunityInfo() { Map param = requestParams(); - if(param.get("areaId") == null || "".equals(param.get("areaId").toString())){ + if (param.get("areaId") == null || "".equals(param.get("areaId").toString())) { return new ArrayList<>(0); } List> list = dataReleaseDao.getCommunityInfo(param); @@ -1002,7 +995,7 @@ public class DataReleaseController extends AbstractController { public SuccessResultList> listPageReportCase(ListPage page) throws SearchException { Map params = requestParams(); // 为了避免案件类型没传,单独处理 - if(params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())){ + if (params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())) { params.put("caseFlowType", "1,2"); } page.setParams(params); @@ -1017,18 +1010,18 @@ public class DataReleaseController extends AbstractController { public SuccessResultList> listPage7DayReportCase(ListPage page) throws SearchException { Map params = requestParams(); // 为了避免案件类型没传,单独处理 - if(params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())){ + if (params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())) { params.put("caseFlowType", "1,2"); } // 查询7天内的数据 - if(params.get("startTime") == null && params.get("endTime") == null){ + if (params.get("startTime") == null && params.get("endTime") == null) { String startTime = DateUtil.getBeforeDate(6, "yyyy-MM-dd"); String endTime = DateUtil.getDay(); params.put("startTime", startTime); params.put("endTime", endTime); } // 案件状态没传情况 - if(params.get("caseStatus") == null || "".equals(params.get("caseStatus").toString())){ + if (params.get("caseStatus") == null || "".equals(params.get("caseStatus").toString())) { params.put("caseStatus", "2,3,4,5,6"); } page.setParams(params); @@ -1067,7 +1060,7 @@ public class DataReleaseController extends AbstractController { } @GetMapping("list-case-in-map") - public BigDataResult listCaseInMap(){ + public BigDataResult listCaseInMap() { BigDataResult bdr = new BigDataResult(); List> resList = new ArrayList<>(); Map query = requestParams(); @@ -1076,10 +1069,10 @@ public class DataReleaseController extends AbstractController { query.put("startTime", startTime); query.put("endTime", endTime); List> caseList = dataReleaseDao.listCaseInMap(query); - for(Map item : caseList){ - if(item.get("case_longitude") != null && item.get("case_latitude") != null){ + for (Map item : caseList) { + if (item.get("case_longitude") != null && item.get("case_latitude") != null) { Map resObj = new HashMap<>(8); - resObj.put("gmtCreate", item.get("gmt_create").toString().substring(0,19)); + resObj.put("gmtCreate", item.get("gmt_create").toString().substring(0, 19)); resObj.put("long", item.get("case_longitude").toString()); resObj.put("lat", item.get("case_latitude").toString()); resObj.put("text", item.get("case_content") == null ? "" : item.get("case_content").toString()); @@ -1093,39 +1086,40 @@ public class DataReleaseController extends AbstractController { } @GetMapping("list-case-statistic-ratio") - public SuccessResultList> listCaseStatistic(){ + public SuccessResultList> listCaseStatistic() { Map params = requestParams(); return reportCaseService.listCaseStatisticRatio(params); } /** * 各月份案件统计情况 -大数据 + * * @return */ @GetMapping("list-report-case-month") - public SuccessResultList>> listReportCaseMonth(){ + public SuccessResultList>> listReportCaseMonth() { Map params = requestParams(); Integer year = Integer.parseInt(DateUtil.getYear()); Integer month; - if(DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0,1))){ + if (DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0, 1))) { month = Integer.parseInt(DateUtil.getMonth().replaceAll("0", "")); } else { month = Integer.parseInt(DateUtil.getMonth()); } List monthList = new ArrayList<>(); - for(int i = 0; i < 12; i++){ - if(month - i == 0){ + for (int i = 0; i < 12; i++) { + if (month - i == 0) { monthList.add((year - 1) + "-" + 12); continue; } - if(month - i < 0){ - monthList.add((year -1) + "-" + (12 + (month - i))); + if (month - i < 0) { + monthList.add((year - 1) + "-" + (12 + (month - i))); continue; } monthList.add(year + "-" + (month - i)); } List> resList = new ArrayList<>(); - for(String str : monthList){ + for (String str : monthList) { Map resMap = new HashMap<>(8); String queryTime = str.length() == 6 ? str.replace("-", "-0") : str; params.put("gmtCreateLike", queryTime); @@ -1140,17 +1134,17 @@ public class DataReleaseController extends AbstractController { Integer jiancha = 0; // 已归档 Integer guidang = 0; - for(Map item : list){ - if(item.get("case_status") != null && "2".equals(item.get("case_status").toString())){ + for (Map item : list) { + if (item.get("case_status") != null && "2".equals(item.get("case_status").toString())) { xiapai++; } - if(item.get("case_status") != null && "3".equals(item.get("case_status").toString())){ + if (item.get("case_status") != null && "3".equals(item.get("case_status").toString())) { chuli++; } - if(item.get("case_status") != null && "4".equals(item.get("case_status").toString())){ + if (item.get("case_status") != null && "4".equals(item.get("case_status").toString())) { jiancha++; } - if(item.get("case_status") != null && "6".equals(item.get("case_status").toString())){ + if (item.get("case_status") != null && "6".equals(item.get("case_status").toString())) { guidang++; } } @@ -1165,17 +1159,18 @@ public class DataReleaseController extends AbstractController { /** * 大数据页面人员实施定位 二级弹窗列表页数据接口 + * * @param page * @return */ @GetMapping("list-page-user-location") - public SuccessResultList> listPageUserLocation (ListPage page){ + public SuccessResultList> listPageUserLocation(ListPage page) { Map params = requestParams(); PageHelper.startPage(page.getPage(), page.getRows()); List> userLocationList = dataReleaseDao.listUserLocation(params); List resList = new ArrayList<>(); // 查询用户上传的最新的一条定位信息 - for(Map item : userLocationList){ + for (Map item : userLocationList) { String userId = item.get("creator").toString(); params.put("userId", userId); Map temp = dataReleaseDao.getLastUserLocationInfo(params); @@ -1187,10 +1182,10 @@ public class DataReleaseController extends AbstractController { dto.setIsOverstep(temp.get("is_overstep") == null ? "" : temp.get("is_overstep").toString()); dto.setUserName(temp.get("user_name") == null ? "" : temp.get("user_name").toString()); dto.setCreator(temp.get("creator") == null ? "" : temp.get("creator").toString()); - dto.setGmtCreate(temp.get("gmt_create") == null ? "" : temp.get("gmt_create").toString().substring(11,19)); + dto.setGmtCreate(temp.get("gmt_create") == null ? "" : temp.get("gmt_create").toString().substring(11, 19)); dto.setUserAvatar(temp.get("user_avatar") == null ? "" : temp.get("user_avatar").toString()); // 如果取不到手机号 则使用登录账号 - if(temp.get("user_phone") == null){ + if (temp.get("user_phone") == null) { dto.setUserPhone(temp.get("user_username") == null ? "" : temp.get("user_username").toString()); } else { dto.setUserPhone(temp.get("user_phone").toString()); @@ -1202,7 +1197,7 @@ public class DataReleaseController extends AbstractController { } @GetMapping("list-user-and-points-by-userids-by-grid-service") - public List listUserAndPointsByUserIdsByGridService () throws ParamsException, SearchException{ + public List listUserAndPointsByUserIdsByGridService() throws ParamsException, SearchException { Map params = requestParams(); if (params.get("userIds") == null || StringUtils.isBlank(params.get("userIds").toString())) { return new ArrayList<>(); diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/communityboss/CommunityBossDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/communityboss/CommunityBossDTO.java index a6ed97b..863db84 100755 --- a/src/main/java/com/cm/systemcity/pojo/dtos/communityboss/CommunityBossDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/communityboss/CommunityBossDTO.java @@ -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; } \ No newline at end of file diff --git a/src/main/java/com/cm/systemcity/service/areapoints/impl/AreaPointsServiceImpl.java b/src/main/java/com/cm/systemcity/service/areapoints/impl/AreaPointsServiceImpl.java index 17ee7a4..a03e3ae 100755 --- a/src/main/java/com/cm/systemcity/service/areapoints/impl/AreaPointsServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/areapoints/impl/AreaPointsServiceImpl.java @@ -145,15 +145,15 @@ public class AreaPointsServiceImpl extends AbstractService implements IAreaPoint return easyUITreeDTOs; } - private List setArea(){ + private List setArea() { List resList = new ArrayList<>(); Map param = new HashMap<>(4); param.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c"); // 查询街道 List 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 setCommunity(String areaId){ + private List setCommunity(String areaId) { List resList = new ArrayList<>(); Map param = new HashMap<>(4); param.put("areaId", areaId); // 查询社区 List 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 setGridUser(String areaId, String communityId){ + private List setGridUser(String areaId, String communityId) { List resList = new ArrayList<>(); Map param = new HashMap<>(4); param.put("areaId", areaId); param.put("communityId", communityId); List 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 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 setNPerson(String departmentId){ + private List setNPerson(String departmentId) { List resList = new ArrayList<>(); Map param = new HashMap<>(4); param.put("departmentId", departmentId); List> list = bindingDepartmentService.listNPerson(param); - for(Map item : list ){ + for (Map 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 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; diff --git a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java index 49725ba..071a29f 100755 --- a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java @@ -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 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); diff --git a/src/main/resources/mybatis/mapper/bindingdepartment/bindingdepartment-mapper.xml b/src/main/resources/mybatis/mapper/bindingdepartment/bindingdepartment-mapper.xml index 506bd4a..0786361 100644 --- a/src/main/resources/mybatis/mapper/bindingdepartment/bindingdepartment-mapper.xml +++ b/src/main/resources/mybatis/mapper/bindingdepartment/bindingdepartment-mapper.xml @@ -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 @@ AND t2.user_name = #{userName} + GROUP BY + t1.user_id, + t2.user_name, + t2.user_phone, + t3.relation_id, + t4.department_id ORDER BY LENGTH(t3.relation_id) DESC diff --git a/src/main/resources/mybatis/mapper/datarelease/datarelease-mapper.xml b/src/main/resources/mybatis/mapper/datarelease/datarelease-mapper.xml index 9b1b6ec..1416607 100644 --- a/src/main/resources/mybatis/mapper/datarelease/datarelease-mapper.xml +++ b/src/main/resources/mybatis/mapper/datarelease/datarelease-mapper.xml @@ -108,15 +108,40 @@ diff --git a/src/main/resources/static/assets/js/baidu-map-0.0.1.min.js b/src/main/resources/static/assets/js/baidu-map-0.0.1.min.js index 2f42195..a421338 100644 --- a/src/main/resources/static/assets/js/baidu-map-0.0.1.min.js +++ b/src/main/resources/static/assets/js/baidu-map-0.0.1.min.js @@ -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++];) { diff --git a/src/main/resources/static/route/userlocation/map_summary.html b/src/main/resources/static/route/userlocation/map_summary.html index 092dc19..1691621 100644 --- a/src/main/resources/static/route/userlocation/map_summary.html +++ b/src/main/resources/static/route/userlocation/map_summary.html @@ -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; + } @@ -96,12 +160,34 @@ +
+ 关键字 + + +
- +
+
+ 网格名称: + 网格名称啥的 +
+
+ 地区: + 地区/社区 +
+
+
+
+
+ XXXXX + XXXXX +
+
+ @@ -111,7 +197,7 @@ - +