|
|
@ -45,6 +45,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.hssf.record.PageBreakRecord; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -259,7 +260,7 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
} |
|
|
|
dto.setCategoryList(categories); |
|
|
|
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(item.getCustomerId(), item.getId()); |
|
|
|
if (null != houseInfo){ |
|
|
|
if (null != houseInfo) { |
|
|
|
StringBuffer str = new StringBuffer(); |
|
|
|
str.append(houseInfo.getBuildingName()).append(houseInfo.getUnitName()).append(houseInfo.getDoorName()); |
|
|
|
dto.setHouseName(str.toString()); |
|
|
@ -320,6 +321,7 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
/** |
|
|
|
* 房屋全名:小区、楼栋、单元、房间号 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
@ -350,7 +352,7 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
return; |
|
|
|
} |
|
|
|
BigDecimal avgYsrD = null; |
|
|
|
if (avgYsr != null){ |
|
|
|
if (avgYsr != null) { |
|
|
|
avgYsrD = new BigDecimal(avgYsr.toString()); |
|
|
|
} |
|
|
|
int i = baseDao.updateIcHouseResiNumber(houseId.toString(), Integer.valueOf(resiNumber.toString()), avgYsrD); |
|
|
@ -388,10 +390,10 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
// 校验小区
|
|
|
|
IcNeighborHoodEntity icNeighborHoodEntity = icNeighborHoodDao.getNeighborHoodInfoByName(formDTO); |
|
|
|
if(icNeighborHoodEntity != null && StringUtils.isNotBlank(icNeighborHoodEntity.getId())){ |
|
|
|
if (icNeighborHoodEntity != null && StringUtils.isNotBlank(icNeighborHoodEntity.getId())) { |
|
|
|
formDTO.setVillageId(icNeighborHoodEntity.getId()); |
|
|
|
checkHomeInfoResultInfo.setVillageId(icNeighborHoodEntity.getId()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
checkHomeInfoResultInfo.setCode("1"); |
|
|
|
checkHomeInfoResultInfo.setMsg("小区名称未匹配到数据"); |
|
|
|
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo); |
|
|
@ -399,10 +401,10 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
// 校验楼宇
|
|
|
|
IcBuildingEntity icBuildingEntity = icBuildingDao.getBuildingInfoByName(formDTO); |
|
|
|
if(icBuildingEntity != null && StringUtils.isNotBlank(icBuildingEntity.getId())){ |
|
|
|
if (icBuildingEntity != null && StringUtils.isNotBlank(icBuildingEntity.getId())) { |
|
|
|
formDTO.setBuildId(icBuildingEntity.getId()); |
|
|
|
checkHomeInfoResultInfo.setBuildId(icBuildingEntity.getId()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
checkHomeInfoResultInfo.setCode("1"); |
|
|
|
checkHomeInfoResultInfo.setMsg("楼宇名称未匹配到数据"); |
|
|
|
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo); |
|
|
@ -410,10 +412,10 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
// 校验单元
|
|
|
|
IcBuildingUnitEntity icBuildingUnitEntity = buildingUnitDao.getbuildingUnitInfoByName(formDTO); |
|
|
|
if(icBuildingUnitEntity != null && StringUtils.isNotBlank(icBuildingUnitEntity.getId())){ |
|
|
|
if (icBuildingUnitEntity != null && StringUtils.isNotBlank(icBuildingUnitEntity.getId())) { |
|
|
|
formDTO.setUnitId(icBuildingUnitEntity.getId()); |
|
|
|
checkHomeInfoResultInfo.setUnitId(icBuildingUnitEntity.getId()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
checkHomeInfoResultInfo.setCode("1"); |
|
|
|
checkHomeInfoResultInfo.setMsg("单元名称未匹配到数据"); |
|
|
|
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo); |
|
|
@ -422,11 +424,11 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
// 校验房屋
|
|
|
|
IcHouseEntity icHouseEntity = baseDao.getHouseInfoByName(formDTO); |
|
|
|
checkHomeInfoResultInfo.setCode("0"); |
|
|
|
if(icHouseEntity != null && StringUtils.isNotBlank(icHouseEntity.getId())){ |
|
|
|
if (icHouseEntity != null && StringUtils.isNotBlank(icHouseEntity.getId())) { |
|
|
|
checkHomeInfoResultInfo.setHomeId(icHouseEntity.getId()); |
|
|
|
checkHomeInfoResultInfo.setMsg("该房屋为已存在房屋"); |
|
|
|
checkHomeInfoResultInfo.setIsAdd("0"); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
checkHomeInfoResultInfo.setMsg("该房屋暂不存在"); |
|
|
|
checkHomeInfoResultInfo.setIsAdd("1"); |
|
|
|
} |
|
|
@ -436,63 +438,88 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
@Override |
|
|
|
public HouseCountPictureResultDTO getHousePurposeCount(HouseCountPictureFormDTO dto) { |
|
|
|
HouseCountPictureResultDTO resultDTO; |
|
|
|
// 如果缓存中有 并且是烟台市级别的 可以从缓存取。一级页面缓存处理
|
|
|
|
if (null != redisUtils.get(RedisKeys.getHousePurposeCountKey()) && "1535072605630230530".equals(dto.getOrgId()) && "1535072605630230530".equals(dto.getOrgIdPath())) { |
|
|
|
resultDTO = (HouseCountPictureResultDTO) redisUtils.get(RedisKeys.getHousePurposeCountKey()); |
|
|
|
} else { |
|
|
|
resultDTO = getHouseCountPictureResultDTO(dto); |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updataHouseCount() { |
|
|
|
HouseCountPictureFormDTO dto = new HouseCountPictureFormDTO(); |
|
|
|
dto.setOrgId("1535072605630230530"); |
|
|
|
dto.setOrgIdPath("1535072605630230530"); |
|
|
|
dto.setOrgType("city"); |
|
|
|
HouseCountPictureResultDTO houseCountPictureResultDTO = getHouseCountPictureResultDTO(dto); |
|
|
|
redisUtils.set(RedisKeys.getHousePurposeCountKey(), houseCountPictureResultDTO, RedisUtils.DEFAULT_EXPIRE); |
|
|
|
// 房屋用途
|
|
|
|
HouseCountPictureResultDTO houseStatusDTO = getHouseStatusDTO(dto); |
|
|
|
redisUtils.set(RedisKeys.getHouseStatusCountKey(), houseStatusDTO, RedisUtils.DEFAULT_EXPIRE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private HouseCountPictureResultDTO getHouseCountPictureResultDTO(HouseCountPictureFormDTO dto) { |
|
|
|
HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO(); |
|
|
|
|
|
|
|
Map<String,String> type = new HashMap<>(); |
|
|
|
Map<String, String> type = new HashMap<>(); |
|
|
|
|
|
|
|
resultDTO.setTotal(0); |
|
|
|
|
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ |
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") || dto.getOrgType().equals("district") || dto.getOrgType().equals("city")) { |
|
|
|
dto.setOrgType("agency"); |
|
|
|
} |
|
|
|
|
|
|
|
List<HouseCountPictureListResultDTO> list = baseDao.getHousePurposeCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd()); |
|
|
|
List<HouseCountPictureListResultDTO> list = baseDao.getHousePurposeCount(dto.getOrgId(), dto.getOrgType(), dto.getTimeStart(), dto.getTimeEnd()); |
|
|
|
|
|
|
|
list.forEach( |
|
|
|
result->{ |
|
|
|
resultDTO.setTotal(resultDTO.getTotal()+result.getCount()); |
|
|
|
type.put(result.getType(),result.getType()); |
|
|
|
result -> { |
|
|
|
resultDTO.setTotal(resultDTO.getTotal() + result.getCount()); |
|
|
|
type.put(result.getType(), result.getType()); |
|
|
|
} |
|
|
|
); |
|
|
|
HouseCountPictureListResultDTO houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
if (type.get("1") == null){ |
|
|
|
if (type.get("1") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("1"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("2") == null){ |
|
|
|
if (type.get("2") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("2"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("3") == null){ |
|
|
|
if (type.get("3") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("3"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("4") == null){ |
|
|
|
if (type.get("4") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("4"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("5") == null){ |
|
|
|
if (type.get("5") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("5"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("6") == null){ |
|
|
|
if (type.get("6") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("6"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("7") == null){ |
|
|
|
if (type.get("7") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("7"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
@ -504,54 +531,65 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
@Override |
|
|
|
public HouseCountPictureResultDTO getHouseStatusCount(HouseCountPictureFormDTO dto) { |
|
|
|
HouseCountPictureResultDTO resultDTO; |
|
|
|
// 如果缓存中有 并且是烟台市级别的 可以从缓存取。一级页面缓存处理
|
|
|
|
if (null != redisUtils.get(RedisKeys.getHousePurposeCountKey()) && "1535072605630230530".equals(dto.getOrgId()) && "1535072605630230530".equals(dto.getOrgIdPath())) { |
|
|
|
resultDTO = (HouseCountPictureResultDTO) redisUtils.get(RedisKeys.getHouseStatusCountKey()); |
|
|
|
} else { |
|
|
|
resultDTO = getHouseStatusDTO(dto); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private HouseCountPictureResultDTO getHouseStatusDTO(HouseCountPictureFormDTO dto) { |
|
|
|
HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO(); |
|
|
|
|
|
|
|
Map<String,String> type = new HashMap<>(); |
|
|
|
Map<String, String> type = new HashMap<>(); |
|
|
|
|
|
|
|
resultDTO.setTotal(0); |
|
|
|
|
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ |
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") || dto.getOrgType().equals("district") || dto.getOrgType().equals("city")) { |
|
|
|
dto.setOrgType("agency"); |
|
|
|
} |
|
|
|
|
|
|
|
List<HouseCountPictureListResultDTO> list =baseDao.getHouseStatusCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd()); |
|
|
|
List<HouseCountPictureListResultDTO> list = baseDao.getHouseStatusCount(dto.getOrgId(), dto.getOrgType(), dto.getTimeStart(), dto.getTimeEnd()); |
|
|
|
|
|
|
|
list.forEach( |
|
|
|
result->{ |
|
|
|
type.put(result.getType(),result.getType()); |
|
|
|
resultDTO.setTotal(resultDTO.getTotal()+result.getCount()); |
|
|
|
result -> { |
|
|
|
type.put(result.getType(), result.getType()); |
|
|
|
resultDTO.setTotal(resultDTO.getTotal() + result.getCount()); |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
HouseCountPictureListResultDTO houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
if (type.get("1") == null){ |
|
|
|
if (type.get("1") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("1"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("2") == null){ |
|
|
|
if (type.get("2") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("2"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("3") == null){ |
|
|
|
if (type.get("3") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("3"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
if (type.get("0") == null){ |
|
|
|
if (type.get("0") == null) { |
|
|
|
houseCountPictureListResultDTO = new HouseCountPictureListResultDTO(); |
|
|
|
houseCountPictureListResultDTO.setType("0"); |
|
|
|
houseCountPictureListResultDTO.setCount(0); |
|
|
|
list.add(houseCountPictureListResultDTO); |
|
|
|
} |
|
|
|
resultDTO.setList(list); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
@ -560,22 +598,22 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
// 列表/导出查询
|
|
|
|
PageHelper.startPage(dto.getPageNo(), dto.getPageSize()); |
|
|
|
|
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ |
|
|
|
if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") || dto.getOrgType().equals("district") || dto.getOrgType().equals("city")) { |
|
|
|
dto.setOrgType("agency"); |
|
|
|
} |
|
|
|
|
|
|
|
List<HousePictureListResultDTO> list = baseDao.getHousePictureList(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd(),dto.getPurpose(),dto.getRentFlag()); |
|
|
|
List<HousePictureListResultDTO> list = baseDao.getHousePictureList(dto.getOrgId(), dto.getOrgType(), dto.getTimeStart(), dto.getTimeEnd(), dto.getPurpose(), dto.getRentFlag()); |
|
|
|
|
|
|
|
list.forEach(entity->{ |
|
|
|
list.forEach(entity -> { |
|
|
|
String[] agencyIds = entity.getOrgIdPath().split(":"); |
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> queryWrapperAgency = new LambdaQueryWrapper<CustomerAgencyEntity>().in(CustomerAgencyEntity::getId,agencyIds); |
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> queryWrapperAgency = new LambdaQueryWrapper<CustomerAgencyEntity>().in(CustomerAgencyEntity::getId, agencyIds); |
|
|
|
List<CustomerAgencyEntity> customerAgencyEntities = customerAgencyDao.selectList(queryWrapperAgency); |
|
|
|
customerAgencyEntities.forEach(agency->{ |
|
|
|
if (agency.getLevel().equals("district")){ |
|
|
|
customerAgencyEntities.forEach(agency -> { |
|
|
|
if (agency.getLevel().equals("district")) { |
|
|
|
entity.setDistrictName(agency.getOrganizationName()); |
|
|
|
}else if (agency.getLevel().equals("street")){ |
|
|
|
} else if (agency.getLevel().equals("street")) { |
|
|
|
entity.setStreetName(agency.getOrganizationName()); |
|
|
|
}else if (agency.getLevel().equals("community")){ |
|
|
|
} else if (agency.getLevel().equals("community")) { |
|
|
|
entity.setCommunityName(agency.getOrganizationName()); |
|
|
|
} |
|
|
|
}); |
|
|
@ -583,6 +621,6 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
|
|
|
|
|
PageInfo<HousePictureListResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
|
|
|
|
return new PageData<>(list,pageInfo.getTotal()); |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
} |
|
|
|