后台运行区域初始化工作,处理实体类中null的问题
This commit is contained in:
parent
c4882be424
commit
024e5ab280
@ -139,13 +139,13 @@ public class PopulationController extends AbstractController {
|
||||
@GetMapping("findHouse")
|
||||
public SuccessResultList<List<PopulationDTO>> findHouse(ListPage page) {
|
||||
Map<String, Object> 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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -31,6 +31,7 @@ public class AreaUtils {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
new Thread(() -> {
|
||||
PopulationInfoStaticService = PopulationInfoService;
|
||||
initArea0();
|
||||
initArea1();
|
||||
@ -42,6 +43,7 @@ public class AreaUtils {
|
||||
aree.put(2, area2);
|
||||
aree.put(3, area3);
|
||||
aree.put(4, area4);
|
||||
}).start();
|
||||
}
|
||||
|
||||
public List<AreaZtreeDTO> 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<String, AreaZtreeDTO> dataMap = aree.get(level + 1);
|
||||
if (dataMap != null) {
|
||||
// 找出所有的子类
|
||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||
for (Map.Entry<String, AreaZtreeDTO> 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<String> names = new ArrayList<>();
|
||||
getParent(level, names, id);
|
||||
@ -74,7 +76,7 @@ public class AreaUtils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(StringUtils.isEmpty(id)) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
ztreeDTO.setTitle(ztreeDTO.getName());
|
||||
list.add(ztreeDTO);
|
||||
}
|
||||
@ -89,9 +91,9 @@ public class AreaUtils {
|
||||
Map<String, AreaZtreeDTO> dataMap = aree.get(level);
|
||||
if (level > -1 && dataMap != null) {
|
||||
level--;
|
||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||
for (Map.Entry<String, AreaZtreeDTO> 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());
|
||||
break;
|
||||
@ -103,8 +105,8 @@ public class AreaUtils {
|
||||
|
||||
private static void initArea0() {
|
||||
List<AreaZtreeDTO> 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<AreaZtreeDTO> 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<AreaZtreeDTO> 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<AreaZtreeDTO> 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<AreaZtreeDTO> 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);
|
||||
|
@ -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 ? `
|
||||
<div class="option">
|
||||
|
Loading…
Reference in New Issue
Block a user