|
|
@ -4,8 +4,6 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelReader; |
|
|
|
import com.alibaba.excel.read.metadata.ReadSheet; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
@ -14,6 +12,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
@ -33,7 +32,7 @@ import com.epmet.dto.IcBuildingUnitDTO; |
|
|
|
import com.epmet.dto.IcHouseDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.HouseInfoDTO; |
|
|
|
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|
|
|
import com.epmet.dto.result.IcHouseListResultDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.dto.result.NeighborHoodManageDelResultDTO; |
|
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
@ -49,6 +48,8 @@ import com.epmet.model.ImportHouseInfoListener; |
|
|
|
import com.epmet.redis.IcHouseRedis; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.util.ExcelPoiUtils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -102,7 +103,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void addHouse(String customerId, IcHouseFormDTO formDTO) { |
|
|
|
public void addHouse(String customerId, IcHouseAddFormDTO formDTO) { |
|
|
|
//同一楼栋,单元内,房屋名称唯一
|
|
|
|
Integer count = icHouseDao.checkDoorNameUq(formDTO.getNeighborHoodId(), formDTO.getBuildingId(), formDTO.getBuildingUnitId(), formDTO.getDoorName(),null); |
|
|
|
if (null != count && count > 0) { |
|
|
@ -116,7 +117,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
icHouseService.save(icHouseDTO); |
|
|
|
} |
|
|
|
|
|
|
|
private String getHouseName(IcHouseFormDTO formDTO){ |
|
|
|
private String getHouseName(IcHouseAddFormDTO formDTO){ |
|
|
|
//设置房间名 楼栋-单元号-门牌号
|
|
|
|
IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId()); |
|
|
|
IcBuildingUnitDTO icBuildingUnit = icBuildingUnitService.get(formDTO.getBuildingUnitId()); |
|
|
@ -133,7 +134,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateHouse(String customerId, IcHouseFormDTO formDTO) { |
|
|
|
public void updateHouse(String customerId, IcHouseAddFormDTO formDTO) { |
|
|
|
//同一楼栋,单元内,房屋名称唯一
|
|
|
|
Integer count = icHouseDao.checkDoorNameUq(formDTO.getNeighborHoodId(), formDTO.getBuildingId(), formDTO.getBuildingUnitId(),formDTO.getDoorName(), formDTO.getHouseId()); |
|
|
|
if (null != count && count > 0) { |
|
|
@ -251,37 +252,27 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcNeighborHoodResultDTO listNeighborhood(String ancestorAgencyId, |
|
|
|
String buildingId, |
|
|
|
String ownerName, |
|
|
|
String ownerPhone, |
|
|
|
String neighborHoodName, |
|
|
|
String buildingName, |
|
|
|
Integer pageNo, |
|
|
|
Integer pageSize, |
|
|
|
String id,String level, String rentFlag) { |
|
|
|
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); |
|
|
|
public PageData<IcHouseListResultDTO> getHouseList(IcHouseListFormDTO formDTO) { |
|
|
|
|
|
|
|
// 查询pids
|
|
|
|
String pids = null; |
|
|
|
if (StringUtils.isNotBlank(ancestorAgencyId)) { |
|
|
|
pids = getPids(ancestorAgencyId); |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAgencyId())) { |
|
|
|
pids = getPids(formDTO.getAgencyId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(level) && OrgTypeEnum.AGENCY.getCode().equals(level)){ |
|
|
|
pids = getPids(ancestorAgencyId); |
|
|
|
if (StringUtils.isNotBlank(formDTO.getLevel()) && OrgTypeEnum.AGENCY.getCode().equals(formDTO.getLevel())){ |
|
|
|
pids = getPids(formDTO.getAgencyId()); |
|
|
|
} |
|
|
|
formDTO.setPids(pids); |
|
|
|
|
|
|
|
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(pageNo,pageSize); |
|
|
|
|
|
|
|
IPage<Map<String, Object>> mapIPage = icHouseDao.searchHouseByPage(page, pids, buildingId, ownerName, ownerPhone, neighborHoodName, buildingName,id,level,rentFlag); |
|
|
|
List<Map<String, Object>> records = mapIPage.getRecords(); |
|
|
|
PageInfo<IcHouseListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(),formDTO.getIsPage()).doSelectPageInfo(() -> |
|
|
|
icHouseDao.searchHouseByPage(formDTO)); |
|
|
|
List<IcHouseListResultDTO> records = pageInfo.getList(); |
|
|
|
records.forEach(item->{ |
|
|
|
item.put("houseType", HouseTypeEnums.getTypeValue(item.get("houseTypeKey"))); |
|
|
|
item.put("purpose", HousePurposeEnums.getTypeValue(item.get("purposeKey"))); |
|
|
|
item.setHouseType(HouseTypeEnums.getTypeValue(item.getHouseTypeKey())); |
|
|
|
item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurposeKey())); |
|
|
|
}); |
|
|
|
|
|
|
|
result.setTotal(Long.valueOf(mapIPage.getTotal()).intValue()); |
|
|
|
result.setList(records); |
|
|
|
return result; |
|
|
|
return new PageData<>(records,pageInfo.getTotal()); |
|
|
|
} |
|
|
|
public String getPids(String agencyId){ |
|
|
|
String pids = null; |
|
|
@ -301,7 +292,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
public void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
//如果类型是house 查房屋
|
|
|
|
//导出房屋
|
|
|
|
|
|
|
@ -313,7 +304,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
|
|
|
|
return ; |
|
|
|
} |
|
|
|
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) { |
|
|
|
private List<IcHouseExcel> searchAllHouse(IcHouseListFormDTO formDTO) { |
|
|
|
|
|
|
|
//IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
|
|
|
|
//
|
|
|
|