diff --git a/src/main/java/cn/com/tenlion/systemhouse/controller/api/building/BuildingController.java b/src/main/java/cn/com/tenlion/systemhouse/controller/api/building/BuildingController.java index 945eec5..99bcd70 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/controller/api/building/BuildingController.java +++ b/src/main/java/cn/com/tenlion/systemhouse/controller/api/building/BuildingController.java @@ -108,4 +108,14 @@ public class BuildingController extends DefaultBaseController { return new SuccessResultData<>(buildingService.count(params)); } + /** + * 区域下数据数量 + * 需要传入 areaParentId 统计该地区下级信息 + */ + @GetMapping("data-counts") + public List> dataCount(){ + Map params = requestParams(); + return buildingService.dataCount(params); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/controller/api/buildinghouse/BuildingHouseController.java b/src/main/java/cn/com/tenlion/systemhouse/controller/api/buildinghouse/BuildingHouseController.java index 612b503..ac73aae 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/controller/api/buildinghouse/BuildingHouseController.java +++ b/src/main/java/cn/com/tenlion/systemhouse/controller/api/buildinghouse/BuildingHouseController.java @@ -108,4 +108,14 @@ public class BuildingHouseController extends DefaultBaseController { return new SuccessResultData<>(buildingHouseService.count(params)); } + /** + * 区域下数据数量 + * 需要传入 areaParentId 统计该地区下级信息 + */ + @GetMapping("data-counts") + public List> dataCount(){ + Map params = requestParams(); + return buildingHouseService.dataCount(params); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java b/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java index effa2b2..1b8b82b 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java +++ b/src/main/java/cn/com/tenlion/systemhouse/controller/api/residential/ResidentialController.java @@ -129,4 +129,14 @@ public class ResidentialController extends DefaultBaseController { return gridRemoteService.getGridList(sendUrl, areaCode, accessToken); } + /** + * 区域下数据数量 + * 需要传入 areaParentId 统计该地区下级信息 + */ + @GetMapping("data-counts") + public List> dataCount(){ + Map params = requestParams(); + return residentialService.dataCount(params); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/dao/building/IBuildingDao.java b/src/main/java/cn/com/tenlion/systemhouse/dao/building/IBuildingDao.java index b1be4e4..539ec7e 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/dao/building/IBuildingDao.java +++ b/src/main/java/cn/com/tenlion/systemhouse/dao/building/IBuildingDao.java @@ -123,4 +123,6 @@ public interface IBuildingDao { * @throws UpdateException */ void updateGrid(Map params) throws UpdateException; + + Integer dataCount(Map params) throws SearchException; } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/dao/buildinghouse/IBuildingHouseDao.java b/src/main/java/cn/com/tenlion/systemhouse/dao/buildinghouse/IBuildingHouseDao.java index fd7df11..888dbd2 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/dao/buildinghouse/IBuildingHouseDao.java +++ b/src/main/java/cn/com/tenlion/systemhouse/dao/buildinghouse/IBuildingHouseDao.java @@ -135,4 +135,6 @@ public interface IBuildingHouseDao { * @return */ List getIdsByBuildingId(Map params); + + Integer dataCount(Map params) throws SearchException; } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/dao/residential/IResidentialDao.java b/src/main/java/cn/com/tenlion/systemhouse/dao/residential/IResidentialDao.java index de434b8..9f303bf 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/dao/residential/IResidentialDao.java +++ b/src/main/java/cn/com/tenlion/systemhouse/dao/residential/IResidentialDao.java @@ -117,4 +117,5 @@ public interface IResidentialDao { */ Integer count(Map params) throws SearchException; + Integer dataCount(Map params) throws SearchException; } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/building/IBuildingService.java b/src/main/java/cn/com/tenlion/systemhouse/service/building/IBuildingService.java index d78cabe..e584cbf 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/building/IBuildingService.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/building/IBuildingService.java @@ -190,4 +190,11 @@ public interface IBuildingService { * @param params */ void updateGrid(Map params); + + /** + * 区域下数量 + * @param params + * @return + */ + List> dataCount(Map params); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/building/impl/BuildingServiceImpl.java b/src/main/java/cn/com/tenlion/systemhouse/service/building/impl/BuildingServiceImpl.java index cd76903..c00b340 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/building/impl/BuildingServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/building/impl/BuildingServiceImpl.java @@ -18,10 +18,13 @@ import cn.com.tenlion.systemhouse.service.buildinghouse.IBuildingHouseService; import cn.com.tenlion.systemhouse.service.community.ICommunityService; import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService; +import cn.com.tenlion.systemhouse.utils.CheckDataUtils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.SaveException; +import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; +import ink.wgink.mongo.module.dictionary.service.IMongoAreaService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.util.map.HashMapUtil; @@ -57,6 +60,8 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding private KafkaTemplate kafkaTemplate; @Autowired private ICommunityService communityService; + @Autowired + private IMongoAreaService mongoAreaService; @Override public void save(BuildingVO buildingVO) { @@ -251,7 +256,7 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding // 楼宇层数 Integer floor = Integer.valueOf(buildingVO.getFloorCount()); // 每层户数 - Integer countOfFloor = buildingVO.getFloorCount(); + Integer countOfFloor = buildingVO.getHouseCount(); int i = 1; if(value.equals("buildingUnitNum")) { i = Integer.valueOf(BuildingDTO.getUnitCount()) + 1; @@ -393,6 +398,26 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding @Override public List list(Map params) { + if(params.get("areaCode") == null && params.get("areaParentId") != null){ + String areaParentId = "110889"; + if(!"".equals(params.get("areaParentId").toString())){ + areaParentId = params.get("areaParentId").toString(); + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + params.put("areaCode", parentDTO.getAreaCode()); + } + if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){ + String areaCoed = params.get("areaCode").toString(); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = areaCoed.substring(0, (i + 1) * 2 ); + break; + } + } + params.put("areaCodeLike",areaCodeLike); + } return buildingDao.list(params); } @@ -420,6 +445,57 @@ public class BuildingServiceImpl extends DefaultBaseService implements IBuilding return count == null ? 0 : count; } + @Override + public List> dataCount(Map params) { + // 110889 乌兰察布市 + String areaParentId = "110889"; + if(params.get("areaParentId") != null + && params.get("areaParentId").toString().length() > 0){ + areaParentId = params.get("areaParentId").toString(); + } + List areaDTOS = mongoAreaService.listByParentId(areaParentId); + List> areaList = new ArrayList<>(); + int totalPeopleNum = 0; + for(AreaDTO item : areaDTOS){ + Map temp = new HashMap<>(16); + // 查询是否存在子节点 + List subAreaList = mongoAreaService.listByParentId(item.getAreaId()); + temp.put("hasSubArea","false"); + if(subAreaList != null && subAreaList.size() > 0){ + temp.put("hasSubArea","true"); + } + temp.put("areaId",item.getAreaId()); + temp.put("areaParentId",item.getAreaParentId()); + temp.put("areaCode",item.getAreaCode()); + temp.put("areaName",item.getAreaName()); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 ); + break; + } + } + // 查询人员数量 + params.clear(); + params.put("areaCodeLike", areaCodeLike); + Integer counts = buildingDao.dataCount(params); + temp.put("areaPeopleNum", counts); + areaList.add(temp); + totalPeopleNum += counts; + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + Map totalMap = new HashMap<>(16); + totalMap.put("hasSubArea","false"); + totalMap.put("areaId", parentDTO.getAreaId()); + totalMap.put("areaParentId", ""); + totalMap.put("areaCode" , parentDTO.getAreaCode()); + totalMap.put("areaName", "合计"); + totalMap.put("areaPeopleNum", totalPeopleNum); + areaList.add(totalMap); + return areaList; + } + @Override public void updateGrid(Map params) { buildingDao.updateGrid(params); diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/IBuildingHouseService.java b/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/IBuildingHouseService.java index a8a229a..825aa3c 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/IBuildingHouseService.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/IBuildingHouseService.java @@ -196,4 +196,11 @@ public interface IBuildingHouseService { * @param params */ void updateGrid(Map params); + + /** + * 区域下数量 + * @param params + * @return + */ + List> dataCount(Map params); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/impl/BuildingHouseServiceImpl.java b/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/impl/BuildingHouseServiceImpl.java index 6b59ac2..9bca53a 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/impl/BuildingHouseServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/buildinghouse/impl/BuildingHouseServiceImpl.java @@ -18,9 +18,11 @@ import cn.com.tenlion.systemhouse.service.buildinghouse.IBuildingHouseService; import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.houseuser.IHouseUserService; import cn.com.tenlion.systemhouse.service.residential.IResidentialService; +import cn.com.tenlion.systemhouse.utils.CheckDataUtils; import com.alibaba.fastjson.JSONObject; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.module.dictionary.pojo.dtos.AreaDTO; +import ink.wgink.mongo.module.dictionary.service.IMongoAreaService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.util.map.HashMapUtil; @@ -57,6 +59,8 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui private IGridService gridService; @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private IMongoAreaService mongoAreaService; @Override public void save(BuildingHouseVO buildingHouseVO) { @@ -186,6 +190,26 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui @Override public List list(Map params) { + if(params.get("areaCode") == null && params.get("areaParentId") != null){ + String areaParentId = "110889"; + if(!"".equals(params.get("areaParentId").toString())){ + areaParentId = params.get("areaParentId").toString(); + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + params.put("areaCode", parentDTO.getAreaCode()); + } + if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){ + String areaCoed = params.get("areaCode").toString(); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = areaCoed.substring(0, (i + 1) * 2 ); + break; + } + } + params.put("areaCodeLike",areaCodeLike); + } if(!com.alibaba.excel.util.StringUtils.isEmpty(params.get("keywords"))) { List houseUserDTOS = houseUserService.list(params); if(null != houseUserDTOS && houseUserDTOS.size() > 0) { @@ -235,6 +259,57 @@ public class BuildingHouseServiceImpl extends DefaultBaseService implements IBui return count == null ? 0 : count; } + @Override + public List> dataCount(Map params) { + // 110889 乌兰察布市 + String areaParentId = "110889"; + if(params.get("areaParentId") != null + && params.get("areaParentId").toString().length() > 0){ + areaParentId = params.get("areaParentId").toString(); + } + List areaDTOS = mongoAreaService.listByParentId(areaParentId); + List> areaList = new ArrayList<>(); + int totalPeopleNum = 0; + for(AreaDTO item : areaDTOS){ + Map temp = new HashMap<>(16); + // 查询是否存在子节点 + List subAreaList = mongoAreaService.listByParentId(item.getAreaId()); + temp.put("hasSubArea","false"); + if(subAreaList != null && subAreaList.size() > 0){ + temp.put("hasSubArea","true"); + } + temp.put("areaId",item.getAreaId()); + temp.put("areaParentId",item.getAreaParentId()); + temp.put("areaCode",item.getAreaCode()); + temp.put("areaName",item.getAreaName()); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 ); + break; + } + } + // 查询人员数量 + params.clear(); + params.put("areaCodeLike", areaCodeLike); + Integer counts = buildingHouseDao.dataCount(params); + temp.put("areaPeopleNum", counts); + areaList.add(temp); + totalPeopleNum += counts; + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + Map totalMap = new HashMap<>(16); + totalMap.put("hasSubArea","false"); + totalMap.put("areaId", parentDTO.getAreaId()); + totalMap.put("areaParentId", ""); + totalMap.put("areaCode" , parentDTO.getAreaCode()); + totalMap.put("areaName", "合计"); + totalMap.put("areaPeopleNum", totalPeopleNum); + areaList.add(totalMap); + return areaList; + } + @Override public void delAllByBuildingId(Map params) { List ids = buildingHouseDao.getIdsByBuildingId(params); diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/residential/IResidentialService.java b/src/main/java/cn/com/tenlion/systemhouse/service/residential/IResidentialService.java index a228ba3..18f468f 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/residential/IResidentialService.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/residential/IResidentialService.java @@ -185,4 +185,10 @@ public interface IResidentialService { */ Integer count(Map params); + /** + * 区域下数量 + * @param params + * @return + */ + List> dataCount(Map params); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java b/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java index 0d69e9d..3fdca21 100644 --- a/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemhouse/service/residential/impl/ResidentialServiceImpl.java @@ -15,6 +15,7 @@ import cn.com.tenlion.systemhouse.service.community.ICommunityService; import cn.com.tenlion.systemhouse.service.grid.IGridService; import cn.com.tenlion.systemhouse.service.grid.impl.GridServiceImpl; import cn.com.tenlion.systemhouse.service.residential.IResidentialService; +import cn.com.tenlion.systemhouse.utils.CheckDataUtils; import com.alibaba.fastjson.JSONObject; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.SearchException; @@ -55,6 +56,8 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid private IBuildingService buildingService; @Autowired private KafkaTemplate kafkaTemplate; + @Autowired + private IMongoAreaService mongoAreaService; @Override public void save(ResidentialVO residentialVO) { @@ -207,6 +210,26 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid @Override public List list(Map params) { + if(params.get("areaCode") == null && params.get("areaParentId") != null){ + String areaParentId = "110889"; + if(!"".equals(params.get("areaParentId").toString())){ + areaParentId = params.get("areaParentId").toString(); + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + params.put("areaCode", parentDTO.getAreaCode()); + } + if(params.get("areaCode") != null && !"".equals(params.get("areaCode").toString())){ + String areaCoed = params.get("areaCode").toString(); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(areaCoed, 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = areaCoed.substring(0, (i + 1) * 2 ); + break; + } + } + params.put("areaCodeLike",areaCodeLike); + } List residentialDTOList =residentialDao.list(params); if(null != residentialDTOList && residentialDTOList.size() > 0) { for(ResidentialDTO residentialDTO: residentialDTOList) { @@ -243,6 +266,57 @@ public class ResidentialServiceImpl extends DefaultBaseService implements IResid return count == null ? 0 : count; } + @Override + public List> dataCount(Map params) { + // 110889 乌兰察布市 + String areaParentId = "110889"; + if(params.get("areaParentId") != null + && params.get("areaParentId").toString().length() > 0){ + areaParentId = params.get("areaParentId").toString(); + } + List areaDTOS = mongoAreaService.listByParentId(areaParentId); + List> areaList = new ArrayList<>(); + int totalPeopleNum = 0; + for(AreaDTO item : areaDTOS){ + Map temp = new HashMap<>(16); + // 查询是否存在子节点 + List subAreaList = mongoAreaService.listByParentId(item.getAreaId()); + temp.put("hasSubArea","false"); + if(subAreaList != null && subAreaList.size() > 0){ + temp.put("hasSubArea","true"); + } + temp.put("areaId",item.getAreaId()); + temp.put("areaParentId",item.getAreaParentId()); + temp.put("areaCode",item.getAreaCode()); + temp.put("areaName",item.getAreaName()); + String[] areaCodeSplit = CheckDataUtils.splitStringByLength(item.getAreaCode(), 2); + String areaCodeLike = ""; + for(int i = 5 ; i >= 0; i--){ + if(!"00".equals(areaCodeSplit[i])){ + areaCodeLike = item.getAreaCode().substring(0, (i + 1) * 2 ); + break; + } + } + // 查询人员数量 + params.clear(); + params.put("areaCodeLike", areaCodeLike); + Integer counts = residentialDao.dataCount(params); + temp.put("areaPeopleNum", counts); + areaList.add(temp); + totalPeopleNum += counts; + } + AreaDTO parentDTO = mongoAreaService.get(areaParentId); + Map totalMap = new HashMap<>(16); + totalMap.put("hasSubArea","false"); + totalMap.put("areaId", parentDTO.getAreaId()); + totalMap.put("areaParentId", ""); + totalMap.put("areaCode" , parentDTO.getAreaCode()); + totalMap.put("areaName", "合计"); + totalMap.put("areaPeopleNum", totalPeopleNum); + areaList.add(totalMap); + return areaList; + } + private AreaDTO getAreaMsg(String areaId) { if(!StringUtils.isEmpty(areaId)) { AreaDTO areaDTO = areaService.get(areaId); diff --git a/src/main/java/cn/com/tenlion/systemhouse/utils/CheckDataUtils.java b/src/main/java/cn/com/tenlion/systemhouse/utils/CheckDataUtils.java new file mode 100644 index 0000000..74011f2 --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemhouse/utils/CheckDataUtils.java @@ -0,0 +1,25 @@ +package cn.com.tenlion.systemhouse.utils; + +public class CheckDataUtils { + + public static String[] splitStringByLength(String src, int length) { + //检查参数是否合法 + if (null == src || src.equals("")) { + return null; + } + if (length <= 0) { + return null; + } + //获取整个字符串可以被切割成字符子串的个数 + int n = (src.length() + length - 1) / length; + String[] split = new String[n]; + for (int i = 0; i < n; i++) { + if (i < (n -1)) { + split[i] = src.substring(i * length, (i + 1) * length); + } else { + split[i] = src.substring(i * length); + } + } + return split; + } +} diff --git a/src/main/resources/mybatis/mapper/building/building-mapper.xml b/src/main/resources/mybatis/mapper/building/building-mapper.xml index d27d595..46a436a 100644 --- a/src/main/resources/mybatis/mapper/building/building-mapper.xml +++ b/src/main/resources/mybatis/mapper/building/building-mapper.xml @@ -341,6 +341,9 @@ house_building t1 WHERE t1.is_delete = 0 + + AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%') + AND ( t1.id LIKE CONCAT('%', #{keywords}, '%') @@ -472,4 +475,23 @@ t1.is_delete = 0 + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml b/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml index 4dbe4fb..822fa93 100644 --- a/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml +++ b/src/main/resources/mybatis/mapper/buildinghouse/building-house-mapper.xml @@ -239,6 +239,9 @@ house_building_house t1 LEFT JOIN house_building t2 ON t1.building_id = t2.building_id AND t2.is_delete = 0 WHERE t1.is_delete = 0 + + AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%') + AND ( t1.building_name LIKE CONCAT('%', #{keywords}, '%') @@ -359,4 +362,23 @@ t1.is_delete = 0 + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml index 7ea54ce..1cb8f24 100644 --- a/src/main/resources/mybatis/mapper/residential/residential-mapper.xml +++ b/src/main/resources/mybatis/mapper/residential/residential-mapper.xml @@ -395,6 +395,9 @@ t1.residential_name LIKE CONCAT('%', #{keywords}, '%') ) + + AND t1.location_code LIKE CONCAT(#{areaCodeLike}, '%') + AND t1.residential_id IN @@ -500,4 +503,23 @@ t1.is_delete = 0 + + + \ No newline at end of file diff --git a/src/main/resources/templates/building/list.html b/src/main/resources/templates/building/list.html index 8641797..d00b9b2 100644 --- a/src/main/resources/templates/building/list.html +++ b/src/main/resources/templates/building/list.html @@ -12,8 +12,57 @@
-
-
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
行政区域数量
+
+
+
+
+
@@ -57,17 +106,68 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; var common = layui.common; var resizeTimeout = null; var tableUrl = 'api/building/listpage'; var residentialId = top.restAjax.params(window.location.href).residentialId; + var areaParentId = ['']; + var areaCode = ''; + + $('#left-card-div').height($win.height() - 30); + $('#left-card-div').css('overflow', 'auto'); + + function initData(){ + initDate(); + initTable(); + listAreaUserCounts(); + } + initData(); + + function listAreaUserCounts(){ + var loadIndex = layer.load(0,{shade : 0.3}); + top.restAjax.get(top.restAjax.path('api/building/data-counts', []), + {areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) { + laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) { + document.getElementById('areaUserCountBox').innerHTML = html; + }); + layer.close(loadIndex); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + + // 绑定点击区域切换事件 + $(document).on('click', '.change-area', function(){ + areaParentId.push($(this).data().areaid); + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + + // 点击人员查看人员列表 + $(document).on('click', '.people-event', function(){ + areaCode = $(this).data().areacode; + reloadTable(); + }); + + // 返回上级 + $(document).on('click', '#backToArea',function(){ + if(areaParentId.length > 1){ + areaParentId.splice(areaParentId.length - 1, 1); + } + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + // 初始化表格 function initTable() { if(residentialId) { @@ -183,10 +283,8 @@ var data = obj.data; // 任务转派 if('addLeader' == obj.event) { - console.log(data) addLeader(data); }else if('houseList' == obj.event) { - console.log(data) houseList(data); } }); @@ -198,7 +296,9 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + areaParentId : areaParentId[areaParentId.length -1], + areaCode : areaCode }, page: { curr: currentPage @@ -240,8 +340,6 @@ } }); } - initTable(); - initDate(); // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); diff --git a/src/main/resources/templates/buildinghouse/list-rental.html b/src/main/resources/templates/buildinghouse/list-rental.html index a437abc..d1501cb 100644 --- a/src/main/resources/templates/buildinghouse/list-rental.html +++ b/src/main/resources/templates/buildinghouse/list-rental.html @@ -12,8 +12,57 @@
-
-
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
行政区域数量
+
+
+
+
+
@@ -51,16 +100,67 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; var common = layui.common; var resizeTimeout = null; var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}'; + var areaParentId = ['']; + var areaCode = ''; + + $('#left-card-div').height($win.height() - 30); + $('#left-card-div').css('overflow', 'auto'); + + function initData(){ + initDate(); + initTable(); + listAreaUserCounts(); + } + initData(); + + function listAreaUserCounts(){ + var loadIndex = layer.load(0,{shade : 0.3}); + top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []), + {areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) { + laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) { + document.getElementById('areaUserCountBox').innerHTML = html; + }); + layer.close(loadIndex); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + + // 绑定点击区域切换事件 + $(document).on('click', '.change-area', function(){ + areaParentId.push($(this).data().areaid); + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + + // 点击人员查看人员列表 + $(document).on('click', '.people-event', function(){ + areaCode = $(this).data().areacode; + reloadTable(); + }); + + // 返回上级 + $(document).on('click', '#backToArea',function(){ + if(areaParentId.length > 1){ + areaParentId.splice(areaParentId.length - 1, 1); + } + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + // 初始化表格 function initTable() { table.render({ @@ -142,7 +242,9 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + areaParentId : areaParentId[areaParentId.length -1], + areaCode : areaCode }, page: { curr: currentPage @@ -163,9 +265,6 @@ }); } - initTable(); - initDate(); - // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); diff --git a/src/main/resources/templates/buildinghouse/list-sharing.html b/src/main/resources/templates/buildinghouse/list-sharing.html index 1c3dc27..cecb42f 100644 --- a/src/main/resources/templates/buildinghouse/list-sharing.html +++ b/src/main/resources/templates/buildinghouse/list-sharing.html @@ -12,8 +12,57 @@
-
-
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
行政区域数量
+
+
+
+
+
@@ -51,16 +100,67 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; var common = layui.common; var resizeTimeout = null; var tableUrl = 'api/buildinghouse/listpage?houseStatus={houseStatus}'; + var areaParentId = ['']; + var areaCode = ''; + + $('#left-card-div').height($win.height() - 30); + $('#left-card-div').css('overflow', 'auto'); + + function initData(){ + initDate(); + initTable(); + listAreaUserCounts(); + } + initData(); + + function listAreaUserCounts(){ + var loadIndex = layer.load(0,{shade : 0.3}); + top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []), + {areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) { + laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) { + document.getElementById('areaUserCountBox').innerHTML = html; + }); + layer.close(loadIndex); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + + // 绑定点击区域切换事件 + $(document).on('click', '.change-area', function(){ + areaParentId.push($(this).data().areaid); + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + + // 点击人员查看人员列表 + $(document).on('click', '.people-event', function(){ + areaCode = $(this).data().areacode; + reloadTable(); + }); + + // 返回上级 + $(document).on('click', '#backToArea',function(){ + if(areaParentId.length > 1){ + areaParentId.splice(areaParentId.length - 1, 1); + } + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + // 初始化表格 function initTable() { table.render({ @@ -176,7 +276,9 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + areaParentId : areaParentId[areaParentId.length -1], + areaCode : areaCode }, page: { curr: currentPage @@ -197,9 +299,6 @@ }); } - initTable(); - initDate(); - // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); diff --git a/src/main/resources/templates/buildinghouse/list.html b/src/main/resources/templates/buildinghouse/list.html index 47f6891..1e2ab51 100644 --- a/src/main/resources/templates/buildinghouse/list.html +++ b/src/main/resources/templates/buildinghouse/list.html @@ -12,8 +12,57 @@
-
-
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
行政区域数量
+
+
+
+
+
@@ -51,16 +100,68 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laytpl', 'laydate', 'common'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; var common = layui.common; var resizeTimeout = null; var tableUrl = 'api/buildinghouse/listpage'; var buildingId = top.restAjax.params(window.location.href).buildingId; + + var areaParentId = ['']; + var areaCode = ''; + + $('#left-card-div').height($win.height() - 30); + $('#left-card-div').css('overflow', 'auto'); + + function initData(){ + initDate(); + initTable(); + listAreaUserCounts(); + } + initData(); + + function listAreaUserCounts(){ + var loadIndex = layer.load(0,{shade : 0.3}); + top.restAjax.get(top.restAjax.path('api/buildinghouse/data-counts', []), + {areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) { + laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) { + document.getElementById('areaUserCountBox').innerHTML = html; + }); + layer.close(loadIndex); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + + // 绑定点击区域切换事件 + $(document).on('click', '.change-area', function(){ + areaParentId.push($(this).data().areaid); + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + + // 点击人员查看人员列表 + $(document).on('click', '.people-event', function(){ + areaCode = $(this).data().areacode; + reloadTable(); + }); + + // 返回上级 + $(document).on('click', '#backToArea',function(){ + if(areaParentId.length > 1){ + areaParentId.splice(areaParentId.length - 1, 1); + } + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + // 初始化表格 function initTable() { if(buildingId) { @@ -145,7 +246,9 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + areaParentId : areaParentId[areaParentId.length -1], + areaCode : areaCode }, page: { curr: currentPage @@ -166,9 +269,6 @@ }); } - initTable(); - initDate(); - // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); diff --git a/src/main/resources/templates/buildingleader/save.html b/src/main/resources/templates/buildingleader/save.html index 139afea..633ef11 100644 --- a/src/main/resources/templates/buildingleader/save.html +++ b/src/main/resources/templates/buildingleader/save.html @@ -211,7 +211,7 @@ // 初始化性别下拉选择 function initSexSelect() { - top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['52038eeb-9d55-4eaa-b3e3-c70a33bdc135']), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['4ef46940-76ab-4758-b5f0-0cbc93ffc660']), {}, null, function(code, data, args) { laytpl(document.getElementById('sexSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('sexSelectTemplateBox').innerHTML = html; }); @@ -223,7 +223,7 @@ // 初始化民族下拉选择 function initNationSelect() { - top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['a6a9a1b1-651f-42a8-84db-8095041d8a5a']), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['a981579c-572b-4fd1-8e76-5d17df97f6a4']), {}, null, function(code, data, args) { laytpl(document.getElementById('nationSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('nationSelectTemplateBox').innerHTML = html; }); @@ -235,7 +235,7 @@ // 初始化政治面貌下拉选择 function initOutlookSelect() { - top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['616350d7-03c0-4b48-861c-ca4d7ed8555f']), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['b2c96de0-3df8-41db-99b1-bc4e24ac6c24']), {}, null, function(code, data, args) { laytpl(document.getElementById('outlookSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('outlookSelectTemplateBox').innerHTML = html; }); @@ -247,7 +247,7 @@ // 初始化学历下拉选择 function initEducationSelect() { - top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['c93682ac-a1a0-4acc-b0bc-828fb86e4b00']), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['d6b9f026-6ea9-456a-b48b-0c18d502523b']), {}, null, function(code, data, args) { laytpl(document.getElementById('educationSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('educationSelectTemplateBox').innerHTML = html; }); diff --git a/src/main/resources/templates/residential/list.html b/src/main/resources/templates/residential/list.html index 5949cd1..f6e48f2 100644 --- a/src/main/resources/templates/residential/list.html +++ b/src/main/resources/templates/residential/list.html @@ -12,8 +12,57 @@
-
-
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
行政区域数量
+
+
+
+
+
@@ -57,16 +106,68 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'laytpl', 'common','util'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; var admin = layui.admin; var laydate = layui.laydate; + var laytpl = layui.laytpl; + var util = layui.util; var common = layui.common; var resizeTimeout = null; var tableUrl = 'api/residential/listpage'; + var areaParentId = ['']; + var areaCode = ''; + + $('#left-card-div').height($win.height() - 30); + $('#left-card-div').css('overflow', 'auto'); + + function initData(){ + initDate(); + initTable(); + listAreaUserCounts(); + } + initData(); + + function listAreaUserCounts(){ + var loadIndex = layer.load(0,{shade : 0.3}); + top.restAjax.get(top.restAjax.path('api/residential/data-counts', []), + {areaParentId : areaParentId[areaParentId.length - 1]}, null, function (code, data) { + laytpl(document.getElementById('areaUserCountTemplate').innerHTML).render(data, function(html) { + document.getElementById('areaUserCountBox').innerHTML = html; + }); + layer.close(loadIndex); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + + // 绑定点击区域切换事件 + $(document).on('click', '.change-area', function(){ + areaParentId.push($(this).data().areaid); + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + + // 点击人员查看人员列表 + $(document).on('click', '.people-event', function(){ + areaCode = $(this).data().areacode; + reloadTable(); + }); + + // 返回上级 + $(document).on('click', '#backToArea',function(){ + if(areaParentId.length > 1){ + areaParentId.splice(areaParentId.length - 1, 1); + } + areaCode = ''; + listAreaUserCounts(); + reloadTable(); + }); + // 初始化表格 function initTable() { table.render({ @@ -167,7 +268,7 @@ return rowData; } }, - {field: 'community', width: 180, title: '社区', align:'center', + {field: 'communityName', width: 180, title: '社区', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -176,13 +277,14 @@ return rowData; } }, - {field: 'remake', width: 180, title: '备注', align:'center', + {field: 'remake', width: 180, maxHeight: 38, title: '备注', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { return '-'; } - return rowData; + var rowData2 = '
'+rowData+'
'; + return rowData2; } }, {field: 'addIntroduction', fixed: 'right', width: 150, title: '小区简介', align:'center', @@ -199,6 +301,9 @@ } ] ], + done: function (res, curr, count) { + bindHeight() + }, page: true, parseData: function(data) { return { @@ -211,6 +316,14 @@ }); } + //固定列 + function bindHeight(){ + $(".layui-table-main tr").each(function (index, val) { + $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height()); + $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height()); + }); + } + //监听行单击事件 table.on('tool(dataTable)', function(obj){ var data = obj.data; @@ -252,7 +365,9 @@ where: { keywords: $('#keywords').val(), startTime: $('#startTime').val(), - endTime: $('#endTime').val() + endTime: $('#endTime').val(), + areaParentId : areaParentId[areaParentId.length -1], + areaCode : areaCode }, page: { curr: currentPage @@ -294,8 +409,6 @@ } }); } - initTable(); - initDate(); // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout);