From 024e5ab28080d3c895749eba5ac842a0c400c4b6 Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Fri, 24 Nov 2023 18:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=BF=90=E8=A1=8C=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B7=A5=E4=BD=9C=EF=BC=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=B8=ADnull?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/population/PopulationController.java | 14 ++-- .../populationinfo/PopulationInfoBaseDTO.java | 9 ++- .../impl/PopulationServiceImpl.java | 4 +- .../com/cm/population/utils/AreaUtils.java | 64 ++++++++++--------- .../templates/house/list-summary.html | 8 ++- 5 files changed, 54 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/cm/population/controller/api/population/PopulationController.java b/src/main/java/com/cm/population/controller/api/population/PopulationController.java index 859f304..232a3ad 100644 --- a/src/main/java/com/cm/population/controller/api/population/PopulationController.java +++ b/src/main/java/com/cm/population/controller/api/population/PopulationController.java @@ -139,13 +139,13 @@ public class PopulationController extends AbstractController { @GetMapping("findHouse") public SuccessResultList> findHouse(ListPage page) { Map params = requestParams(); - if(null == params.get("keywords")) { - try { - throw new SearchException("身份证号/手机号/姓名不能为空"); - } catch (SearchException e) { - e.printStackTrace(); - } - } +// if(null == params.get("keywords")) { +// try { +// throw new SearchException("身份证号/手机号/姓名不能为空"); +// } catch (SearchException e) { +// e.printStackTrace(); +// } +// } page.setParams(params); return populationService.findHouse(page); } diff --git a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java index 1408dc1..355cc17 100644 --- a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java +++ b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java @@ -95,7 +95,7 @@ public class PopulationInfoBaseDTO { } public String getHealthStatus() { - return healthStatus; + return healthStatus == null ? "" : healthStatus; } public void setHealthStatus(String healthStatus) { @@ -103,7 +103,7 @@ public class PopulationInfoBaseDTO { } public String getIsMinority() { - if(getAge() < 18) { + if (getAge() < 18) { return "是"; } return "否"; @@ -114,7 +114,7 @@ public class PopulationInfoBaseDTO { } public String getIsSeriousIllness() { - if(getHealthStatus().contains("重病")) { + if (getHealthStatus().contains("重病")) { return "是"; } return "否"; @@ -125,6 +125,9 @@ public class PopulationInfoBaseDTO { } public Integer getAge() { + if (StringUtils.isBlank(this.getBirthday())) { + return 0; + } LocalDate birthDate = LocalDate.parse(this.birthday); Period period = Period.between(birthDate, LocalDate.now()); return period.getYears(); diff --git a/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java b/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java index 4e5852d..b8a3da2 100644 --- a/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java +++ b/src/main/java/com/cm/population/service/population/impl/PopulationServiceImpl.java @@ -516,11 +516,11 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio for (PopulationDTO populationDTO : overList) { if (StringUtils.isNotEmpty(populationDTO.getPopulationInfoId())) { - PopulationInfoBaseDTO populationInfoBaseDTO=null; + PopulationInfoBaseDTO populationInfoBaseDTO = null; if (null != baseMap) { // 获取人员 populationInfoBaseDTO = baseMap.get(populationDTO.getPopulationInfoId()); - }else { + } else { populationInfoBaseDTO = setPopulationBaseInfo(populationDTO); } // populationInfoService.getTuoMin(populationInfoBaseDTO); diff --git a/src/main/java/com/cm/population/utils/AreaUtils.java b/src/main/java/com/cm/population/utils/AreaUtils.java index 130db51..4f099f3 100644 --- a/src/main/java/com/cm/population/utils/AreaUtils.java +++ b/src/main/java/com/cm/population/utils/AreaUtils.java @@ -31,17 +31,19 @@ public class AreaUtils { @PostConstruct public void init() { - PopulationInfoStaticService = PopulationInfoService; - initArea0(); - initArea1(); - initArea2(); - initArea3(); - initArea4(); - aree.put(0, area0); - aree.put(1, area1); - aree.put(2, area2); - aree.put(3, area3); - aree.put(4, area4); + new Thread(() -> { + PopulationInfoStaticService = PopulationInfoService; + initArea0(); + initArea1(); + initArea2(); + initArea3(); + initArea4(); + aree.put(0, area0); + aree.put(1, area1); + aree.put(2, area2); + aree.put(3, area3); + aree.put(4, area4); + }).start(); } public List getList(String id) { @@ -50,7 +52,7 @@ public class AreaUtils { Integer level = -1; Integer subCount = 0; // 确定级别 - if (!StringUtils.isEmpty(id) ) { + if (!StringUtils.isEmpty(id)) { AreaZtreeDTO areaDTO = PopulationInfoStaticService.getAreaByAreaId(id); level = Integer.valueOf(areaDTO.getAreaLevel()); subCount = areaDTO.getSubCount(); @@ -58,11 +60,11 @@ public class AreaUtils { Map dataMap = aree.get(level + 1); if (dataMap != null) { // 找出所有的子类 - for(Map.Entry m : dataMap.entrySet()) { + for (Map.Entry m : dataMap.entrySet()) { AreaZtreeDTO ztreeDTO = m.getValue(); String pId = ztreeDTO.getpId(); String title = ztreeDTO.getTitle(); - if(!StringUtils.isEmpty(id) && pId.equals(id)) { + if (!StringUtils.isEmpty(id) && pId.equals(id)) { if (StringUtils.isEmpty(title)) { ArrayList names = new ArrayList<>(); getParent(level, names, id); @@ -74,14 +76,14 @@ public class AreaUtils { break; } } - if(StringUtils.isEmpty(id)) { + if (StringUtils.isEmpty(id)) { ztreeDTO.setTitle(ztreeDTO.getName()); list.add(ztreeDTO); } } } - return list; + return list; } // 递归拼接全名称 @@ -89,11 +91,11 @@ public class AreaUtils { Map dataMap = aree.get(level); if (level > -1 && dataMap != null) { level--; - for(Map.Entry m : dataMap.entrySet()) { + for (Map.Entry m : dataMap.entrySet()) { String id = m.getValue().getId(); - if(pId.equals(id)) { + if (pId.equals(id)) { names.add(0, m.getValue().getName()); - getParent(level, names, m.getValue().getpId()); + getParent(level, names, m.getValue().getpId()); break; } } @@ -103,8 +105,8 @@ public class AreaUtils { private static void initArea0() { List dto = PopulationInfoStaticService.getAreaListByLevel("0", -1); - for(AreaZtreeDTO areaDTO : dto) { - if (areaDTO.getSubCount() > 0 ) { + for (AreaZtreeDTO areaDTO : dto) { + if (areaDTO.getSubCount() > 0) { areaDTO.setIsParent(true); } area0.put(areaDTO.getId(), areaDTO); @@ -113,8 +115,8 @@ public class AreaUtils { private static void initArea1() { List dto = PopulationInfoStaticService.getAreaListByLevel("1", -1); - for(AreaZtreeDTO areaDTO : dto) { - if (areaDTO.getSubCount() > 0 ) { + for (AreaZtreeDTO areaDTO : dto) { + if (areaDTO.getSubCount() > 0) { areaDTO.setIsParent(true); } area1.put(areaDTO.getId(), areaDTO); @@ -123,8 +125,8 @@ public class AreaUtils { private static void initArea2() { List dto = PopulationInfoStaticService.getAreaListByLevel("2", -1); - for(AreaZtreeDTO areaDTO : dto) { - if (areaDTO.getSubCount() > 0 ) { + for (AreaZtreeDTO areaDTO : dto) { + if (areaDTO.getSubCount() > 0) { areaDTO.setIsParent(true); } area2.put(areaDTO.getId(), areaDTO); @@ -132,10 +134,10 @@ public class AreaUtils { } private static void initArea3() { - for(int i = 0 ; i < 9 ; i++ ) { + for (int i = 0; i < 9; i++) { List dto = PopulationInfoStaticService.getAreaListByLevel("3", i); - for(AreaZtreeDTO areaDTO : dto) { - if (areaDTO.getSubCount() > 0 ) { + for (AreaZtreeDTO areaDTO : dto) { + if (areaDTO.getSubCount() > 0) { areaDTO.setIsParent(true); } area3.put(areaDTO.getId(), areaDTO); @@ -144,10 +146,10 @@ public class AreaUtils { } private static void initArea4() { - for(int i = 0 ; i < 67 ; i++ ) { + for (int i = 0; i < 67; i++) { List dto = PopulationInfoStaticService.getAreaListByLevel("4", i); - for(AreaZtreeDTO areaDTO : dto) { - if (areaDTO.getSubCount() > 0 ) { + for (AreaZtreeDTO areaDTO : dto) { + if (areaDTO.getSubCount() > 0) { areaDTO.setIsParent(true); } area4.put(areaDTO.getId(), areaDTO); diff --git a/src/main/resources/templates/house/list-summary.html b/src/main/resources/templates/house/list-summary.html index 3d6f13a..3cdbef2 100644 --- a/src/main/resources/templates/house/list-summary.html +++ b/src/main/resources/templates/house/list-summary.html @@ -407,12 +407,16 @@ var renderMain = function() { var main = ''; $.each(data.floors, function(index, item) { - var units = ''; $.each(item.units, function(jndex, jtem) { - var houses = ''; if(jtem.houses.length > data.units[jndex].maxHouseCount) { data.units[jndex].maxHouseCount = jtem.houses.length; } + }); + }); + $.each(data.floors, function(index, item) { + var units = ''; + $.each(item.units, function(jndex, jtem) { + var houses = ''; $.each(jtem.houses, function(kndex, ktem) { var option = ktem.isCreator === 1 ? `