后台运行区域初始化工作,处理实体类中null的问题
This commit is contained in:
parent
c4882be424
commit
024e5ab280
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
@ -103,7 +103,7 @@ public class PopulationInfoBaseDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getIsMinority() {
|
public String getIsMinority() {
|
||||||
if(getAge() < 18) {
|
if (getAge() < 18) {
|
||||||
return "是";
|
return "是";
|
||||||
}
|
}
|
||||||
return "否";
|
return "否";
|
||||||
@ -114,7 +114,7 @@ public class PopulationInfoBaseDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getIsSeriousIllness() {
|
public String getIsSeriousIllness() {
|
||||||
if(getHealthStatus().contains("重病")) {
|
if (getHealthStatus().contains("重病")) {
|
||||||
return "是";
|
return "是";
|
||||||
}
|
}
|
||||||
return "否";
|
return "否";
|
||||||
@ -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();
|
||||||
|
@ -516,11 +516,11 @@ public class PopulationServiceImpl extends AbstractService implements IPopulatio
|
|||||||
|
|
||||||
for (PopulationDTO populationDTO : overList) {
|
for (PopulationDTO populationDTO : overList) {
|
||||||
if (StringUtils.isNotEmpty(populationDTO.getPopulationInfoId())) {
|
if (StringUtils.isNotEmpty(populationDTO.getPopulationInfoId())) {
|
||||||
PopulationInfoBaseDTO populationInfoBaseDTO=null;
|
PopulationInfoBaseDTO populationInfoBaseDTO = null;
|
||||||
if (null != baseMap) {
|
if (null != baseMap) {
|
||||||
// 获取人员
|
// 获取人员
|
||||||
populationInfoBaseDTO = baseMap.get(populationDTO.getPopulationInfoId());
|
populationInfoBaseDTO = baseMap.get(populationDTO.getPopulationInfoId());
|
||||||
}else {
|
} else {
|
||||||
populationInfoBaseDTO = setPopulationBaseInfo(populationDTO);
|
populationInfoBaseDTO = setPopulationBaseInfo(populationDTO);
|
||||||
}
|
}
|
||||||
// populationInfoService.getTuoMin(populationInfoBaseDTO);
|
// populationInfoService.getTuoMin(populationInfoBaseDTO);
|
||||||
|
@ -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) {
|
||||||
@ -50,7 +52,7 @@ public class AreaUtils {
|
|||||||
Integer level = -1;
|
Integer level = -1;
|
||||||
Integer subCount = 0;
|
Integer subCount = 0;
|
||||||
// 确定级别
|
// 确定级别
|
||||||
if (!StringUtils.isEmpty(id) ) {
|
if (!StringUtils.isEmpty(id)) {
|
||||||
AreaZtreeDTO areaDTO = PopulationInfoStaticService.getAreaByAreaId(id);
|
AreaZtreeDTO areaDTO = PopulationInfoStaticService.getAreaByAreaId(id);
|
||||||
level = Integer.valueOf(areaDTO.getAreaLevel());
|
level = Integer.valueOf(areaDTO.getAreaLevel());
|
||||||
subCount = areaDTO.getSubCount();
|
subCount = areaDTO.getSubCount();
|
||||||
@ -58,11 +60,11 @@ public class AreaUtils {
|
|||||||
Map<String, AreaZtreeDTO> dataMap = aree.get(level + 1);
|
Map<String, AreaZtreeDTO> dataMap = aree.get(level + 1);
|
||||||
if (dataMap != null) {
|
if (dataMap != null) {
|
||||||
// 找出所有的子类
|
// 找出所有的子类
|
||||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
for (Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||||
AreaZtreeDTO ztreeDTO = m.getValue();
|
AreaZtreeDTO ztreeDTO = m.getValue();
|
||||||
String pId = ztreeDTO.getpId();
|
String pId = ztreeDTO.getpId();
|
||||||
String title = ztreeDTO.getTitle();
|
String title = ztreeDTO.getTitle();
|
||||||
if(!StringUtils.isEmpty(id) && pId.equals(id)) {
|
if (!StringUtils.isEmpty(id) && pId.equals(id)) {
|
||||||
if (StringUtils.isEmpty(title)) {
|
if (StringUtils.isEmpty(title)) {
|
||||||
ArrayList<String> names = new ArrayList<>();
|
ArrayList<String> names = new ArrayList<>();
|
||||||
getParent(level, names, id);
|
getParent(level, names, id);
|
||||||
@ -74,7 +76,7 @@ public class AreaUtils {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isEmpty(id)) {
|
if (StringUtils.isEmpty(id)) {
|
||||||
ztreeDTO.setTitle(ztreeDTO.getName());
|
ztreeDTO.setTitle(ztreeDTO.getName());
|
||||||
list.add(ztreeDTO);
|
list.add(ztreeDTO);
|
||||||
}
|
}
|
||||||
@ -89,9 +91,9 @@ public class AreaUtils {
|
|||||||
Map<String, AreaZtreeDTO> dataMap = aree.get(level);
|
Map<String, AreaZtreeDTO> dataMap = aree.get(level);
|
||||||
if (level > -1 && dataMap != null) {
|
if (level > -1 && dataMap != null) {
|
||||||
level--;
|
level--;
|
||||||
for(Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
for (Map.Entry<String, AreaZtreeDTO> m : dataMap.entrySet()) {
|
||||||
String id = m.getValue().getId();
|
String id = m.getValue().getId();
|
||||||
if(pId.equals(id)) {
|
if (pId.equals(id)) {
|
||||||
names.add(0, m.getValue().getName());
|
names.add(0, m.getValue().getName());
|
||||||
getParent(level, names, m.getValue().getpId());
|
getParent(level, names, m.getValue().getpId());
|
||||||
break;
|
break;
|
||||||
@ -103,8 +105,8 @@ public class AreaUtils {
|
|||||||
|
|
||||||
private static void initArea0() {
|
private static void initArea0() {
|
||||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("0", -1);
|
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("0", -1);
|
||||||
for(AreaZtreeDTO areaDTO : dto) {
|
for (AreaZtreeDTO areaDTO : dto) {
|
||||||
if (areaDTO.getSubCount() > 0 ) {
|
if (areaDTO.getSubCount() > 0) {
|
||||||
areaDTO.setIsParent(true);
|
areaDTO.setIsParent(true);
|
||||||
}
|
}
|
||||||
area0.put(areaDTO.getId(), areaDTO);
|
area0.put(areaDTO.getId(), areaDTO);
|
||||||
@ -113,8 +115,8 @@ public class AreaUtils {
|
|||||||
|
|
||||||
private static void initArea1() {
|
private static void initArea1() {
|
||||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("1", -1);
|
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("1", -1);
|
||||||
for(AreaZtreeDTO areaDTO : dto) {
|
for (AreaZtreeDTO areaDTO : dto) {
|
||||||
if (areaDTO.getSubCount() > 0 ) {
|
if (areaDTO.getSubCount() > 0) {
|
||||||
areaDTO.setIsParent(true);
|
areaDTO.setIsParent(true);
|
||||||
}
|
}
|
||||||
area1.put(areaDTO.getId(), areaDTO);
|
area1.put(areaDTO.getId(), areaDTO);
|
||||||
@ -123,8 +125,8 @@ public class AreaUtils {
|
|||||||
|
|
||||||
private static void initArea2() {
|
private static void initArea2() {
|
||||||
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("2", -1);
|
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("2", -1);
|
||||||
for(AreaZtreeDTO areaDTO : dto) {
|
for (AreaZtreeDTO areaDTO : dto) {
|
||||||
if (areaDTO.getSubCount() > 0 ) {
|
if (areaDTO.getSubCount() > 0) {
|
||||||
areaDTO.setIsParent(true);
|
areaDTO.setIsParent(true);
|
||||||
}
|
}
|
||||||
area2.put(areaDTO.getId(), areaDTO);
|
area2.put(areaDTO.getId(), areaDTO);
|
||||||
@ -132,10 +134,10 @@ public class AreaUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initArea3() {
|
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);
|
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("3", i);
|
||||||
for(AreaZtreeDTO areaDTO : dto) {
|
for (AreaZtreeDTO areaDTO : dto) {
|
||||||
if (areaDTO.getSubCount() > 0 ) {
|
if (areaDTO.getSubCount() > 0) {
|
||||||
areaDTO.setIsParent(true);
|
areaDTO.setIsParent(true);
|
||||||
}
|
}
|
||||||
area3.put(areaDTO.getId(), areaDTO);
|
area3.put(areaDTO.getId(), areaDTO);
|
||||||
@ -144,10 +146,10 @@ public class AreaUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initArea4() {
|
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);
|
List<AreaZtreeDTO> dto = PopulationInfoStaticService.getAreaListByLevel("4", i);
|
||||||
for(AreaZtreeDTO areaDTO : dto) {
|
for (AreaZtreeDTO areaDTO : dto) {
|
||||||
if (areaDTO.getSubCount() > 0 ) {
|
if (areaDTO.getSubCount() > 0) {
|
||||||
areaDTO.setIsParent(true);
|
areaDTO.setIsParent(true);
|
||||||
}
|
}
|
||||||
area4.put(areaDTO.getId(), areaDTO);
|
area4.put(areaDTO.getId(), areaDTO);
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user