后台运行区域初始化工作,处理实体类中null的问题

This commit is contained in:
TS-QD1 2023-11-24 18:34:11 +08:00
parent c4882be424
commit 024e5ab280
5 changed files with 54 additions and 45 deletions

View File

@ -139,13 +139,13 @@ public class PopulationController extends AbstractController {
@GetMapping("findHouse") @GetMapping("findHouse")
public SuccessResultList<List<PopulationDTO>> findHouse(ListPage page) { public SuccessResultList<List<PopulationDTO>> findHouse(ListPage page) {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
if(null == params.get("keywords")) { // if(null == params.get("keywords")) {
try { // try {
throw new SearchException("身份证号/手机号/姓名不能为空"); // throw new SearchException("身份证号/手机号/姓名不能为空");
} catch (SearchException e) { // } catch (SearchException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
page.setParams(params); page.setParams(params);
return populationService.findHouse(page); return populationService.findHouse(page);
} }

View File

@ -95,7 +95,7 @@ public class PopulationInfoBaseDTO {
} }
public String getHealthStatus() { public String getHealthStatus() {
return healthStatus; return healthStatus == null ? "" : healthStatus;
} }
public void setHealthStatus(String healthStatus) { public void setHealthStatus(String healthStatus) {
@ -125,6 +125,9 @@ public class PopulationInfoBaseDTO {
} }
public Integer getAge() { public Integer getAge() {
if (StringUtils.isBlank(this.getBirthday())) {
return 0;
}
LocalDate birthDate = LocalDate.parse(this.birthday); LocalDate birthDate = LocalDate.parse(this.birthday);
Period period = Period.between(birthDate, LocalDate.now()); Period period = Period.between(birthDate, LocalDate.now());
return period.getYears(); return period.getYears();

View File

@ -31,6 +31,7 @@ public class AreaUtils {
@PostConstruct @PostConstruct
public void init() { public void init() {
new Thread(() -> {
PopulationInfoStaticService = PopulationInfoService; PopulationInfoStaticService = PopulationInfoService;
initArea0(); initArea0();
initArea1(); initArea1();
@ -42,6 +43,7 @@ public class AreaUtils {
aree.put(2, area2); aree.put(2, area2);
aree.put(3, area3); aree.put(3, area3);
aree.put(4, area4); aree.put(4, area4);
}).start();
} }
public List<AreaZtreeDTO> getList(String id) { public List<AreaZtreeDTO> getList(String id) {

View File

@ -407,12 +407,16 @@
var renderMain = function() { var renderMain = function() {
var main = ''; var main = '';
$.each(data.floors, function(index, item) { $.each(data.floors, function(index, item) {
var units = '';
$.each(item.units, function(jndex, jtem) { $.each(item.units, function(jndex, jtem) {
var houses = '';
if(jtem.houses.length > data.units[jndex].maxHouseCount) { if(jtem.houses.length > data.units[jndex].maxHouseCount) {
data.units[jndex].maxHouseCount = jtem.houses.length; 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) { $.each(jtem.houses, function(kndex, ktem) {
var option = ktem.isCreator === 1 ? ` var option = ktem.isCreator === 1 ? `
<div class="option"> <div class="option">