|
|
@ -19,6 +19,8 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.CustomerGridConstant; |
|
|
|
import com.epmet.dao.IcBuildingDao; |
|
|
|
import com.epmet.dao.IcBuildingUnitDao; |
|
|
|
import com.epmet.dao.IcHouseDao; |
|
|
@ -31,15 +33,18 @@ import com.epmet.dto.form.IcHouseFormDTO; |
|
|
|
import com.epmet.dto.form.ImportInfoFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.form.ListIcNeighborHoodFormDTO; |
|
|
|
import com.epmet.dto.form.NeighborHoodManageDelFormDTO; |
|
|
|
import com.epmet.dto.result.HouseInfoDTO; |
|
|
|
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.dto.result.NeighborHoodManageDelResultDTO; |
|
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
|
import com.epmet.enums.HouseTypeEnums; |
|
|
|
import com.epmet.excel.IcHouseExcel; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.model.HouseInfoModel; |
|
|
|
import com.epmet.model.ImportHouseInfoListener; |
|
|
@ -101,6 +106,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
@Autowired |
|
|
|
private ExecutorService executorService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -382,4 +389,84 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
}); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc 小区管理中批量删除 |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/3/1 4:57 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void allDelete(NeighborHoodManageDelFormDTO formDTO) { |
|
|
|
if (CollectionUtils.isEmpty(formDTO.getIds())){ |
|
|
|
return; |
|
|
|
} |
|
|
|
List<String> ids = formDTO.getIds(); |
|
|
|
if (formDTO.getType().equals(CustomerGridConstant.NEIGHBORHOOD)){ |
|
|
|
List<NeighborHoodManageDelResultDTO> exists = icHouseDao.selectExistBuildingByNeighborHoodIds(ids); |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
exists.forEach(e -> { |
|
|
|
for (int i = NumConstant.ZERO; i < ids.size(); i++) { |
|
|
|
if (ids.get(i).equals(e.getNeighborHoodId())){ |
|
|
|
ids.remove(i); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(ids)){ |
|
|
|
icNeighborHoodDao.deleteBatchIds(ids); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining(",")); |
|
|
|
EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format("%s内包含楼宇信息,暂无法删除",collect)); |
|
|
|
throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode()); |
|
|
|
} |
|
|
|
}else if (formDTO.getType().equals(CustomerGridConstant.BUILDING)){ |
|
|
|
List<NeighborHoodManageDelResultDTO> exists = icHouseDao.selectExistHouseByBuildingIds(ids); |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
exists.forEach(e -> { |
|
|
|
for (int i = NumConstant.ZERO; i < ids.size(); i++) { |
|
|
|
if (ids.get(i).equals(e.getBuildingId())){ |
|
|
|
ids.remove(i); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(ids)){ |
|
|
|
icBuildingDao.deleteBatchIds(ids); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining(",")); |
|
|
|
EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format("%s内包含房屋信息,暂无法删除",collect)); |
|
|
|
throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode()); |
|
|
|
} |
|
|
|
}else if (formDTO.getType().equals(CustomerGridConstant.HOUSE)){ |
|
|
|
Result<List<String>> existUsers = epmetUserOpenFeignClient.getExistUserByHouseIds(ids); |
|
|
|
if (!existUsers.success()){ |
|
|
|
throw new EpmetException("根据房屋IDs查询房屋下是否有存在居民失败..."); |
|
|
|
} |
|
|
|
List<String> exists = existUsers.getData(); |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
exists.forEach(e -> { |
|
|
|
for (int i = NumConstant.ZERO; i < ids.size(); i++) { |
|
|
|
if (ids.get(i).equals(e)){ |
|
|
|
ids.remove(i); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(ids)){ |
|
|
|
icHouseDao.deleteBatchIds(ids); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(exists)){ |
|
|
|
List<String> list = icHouseDao.selectHouseNames(exists); |
|
|
|
String collect = list.stream().collect(Collectors.joining(",")); |
|
|
|
EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format("%s内包含居民信息,暂无法删除",collect)); |
|
|
|
throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|