| | |
| | | List<HouseholdVO> householdVOS = baseMapper.selectHouseholdPage(page, household, commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), commonParamSet.getGridCodeList()); |
| | | stopWatch.stop(); |
| | | if (household.getRelationship() == 18) { |
| | | if (household.getRelationship() != null && household.getRelationship() == 18) { |
| | | householdVOS.forEach(item -> { |
| | | HouseholdEntity householdEntity = getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, item.getHouseCode()) |
| | |
| | | } |
| | | } |
| | | // 判断是否租户导入 |
| | | if (StringUtils.isNotBlank(isTenant)) { |
| | | householdEntity.setRelationship(18); |
| | | HouseRentalEntity houseRentalEntity = iHouseRentalService.getOne(Wrappers.<HouseRentalEntity>lambdaQuery() |
| | | .eq(HouseRentalEntity::getHouseCode, householdEntity.getHouseCode()).last("limit 1")); |
| | | if (houseRentalEntity != null) { |
| | | householdEntity.setHousingRentalId(houseRentalEntity.getId()); |
| | | } else { |
| | | // 新建出租屋 |
| | | HouseRentalEntity rentalEntity = new HouseRentalEntity(); |
| | | rentalEntity.setHouseCode(householdEntity.getHouseCode()); |
| | | rentalEntity.setHouseStatus(1); |
| | | rentalEntity.setAuditStatus(0); |
| | | rentalEntity.setRentalUse(4); |
| | | rentalEntity.setTenantRelationship(1); |
| | | rentalEntity.setRentalTime(new Date()); |
| | | rentalEntity.setDueTime(new Date()); |
| | | rentalEntity.setTerminationTime(new Date()); |
| | | iHouseRentalService.save(rentalEntity); |
| | | householdEntity.setHousingRentalId(rentalEntity.getId()); |
| | | } |
| | | if (StringUtils.isNotBlank(isTenant) || householdEntity.getRelationship() == 18) { |
| | | householdEntity.setRelationship(18); |
| | | HouseRentalEntity houseRentalEntity = iHouseRentalService.getOne(Wrappers.<HouseRentalEntity>lambdaQuery() |
| | | .eq(HouseRentalEntity::getHouseCode, householdEntity.getHouseCode()).last("limit 1")); |
| | | if (houseRentalEntity != null) { |
| | | householdEntity.setHousingRentalId(houseRentalEntity.getId()); |
| | | } else { |
| | | // 新建出租屋 |
| | | HouseRentalEntity rentalEntity = new HouseRentalEntity(); |
| | | rentalEntity.setHouseCode(householdEntity.getHouseCode()); |
| | | rentalEntity.setHouseStatus(1); |
| | | rentalEntity.setAuditStatus(0); |
| | | rentalEntity.setRentalUse(4); |
| | | rentalEntity.setTenantRelationship(1); |
| | | rentalEntity.setRentalTime(new Date()); |
| | | rentalEntity.setDueTime(new Date()); |
| | | rentalEntity.setTerminationTime(new Date()); |
| | | iHouseRentalService.save(rentalEntity); |
| | | householdEntity.setHousingRentalId(rentalEntity.getId()); |
| | | } |
| | | |
| | | // 设置出租房 |
| | | setRentalPropertyLabels(householdEntity); |
| | | } |
| | | /// 是否主要联系人 |
| | | if (!Strings.isBlank(houseHoldExcel.getIsPrimaryContact())) { |
| | | householdEntity.setIsPrimaryContact(Integer.parseInt(houseHoldExcel.getIsPrimaryContact())); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param householdEntity |
| | | */ |
| | | private void setRentalPropertyLabels(HouseholdEntity householdEntity) { |
| | | // 设置房屋标签未出租 |
| | | IUserHouseLabelService householdLabelService = SpringUtils.getBean(IUserHouseLabelService.class); |
| | | long count = householdLabelService.count(Wrappers.<UserHouseLabelEntity>lambdaQuery() |
| | | .eq(UserHouseLabelEntity::getHouseCode, householdEntity.getHouseCode()) |
| | | .eq(UserHouseLabelEntity::getLableType, 2)); |
| | | if (count == 0) { |
| | | UserHouseLabelEntity userHouseLabelEntity = new UserHouseLabelEntity(); |
| | | userHouseLabelEntity.setHouseCode(householdEntity.getHouseCode()); |
| | | userHouseLabelEntity.setLableType(2); |
| | | userHouseLabelEntity.setLabelName("出租"); |
| | | userHouseLabelEntity.setLabelId(1039L); |
| | | userHouseLabelEntity.setColor("yellow"); |
| | | householdLabelService.saveOrUpdateHouseLabel(userHouseLabelEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 标签处理 |
| | | * |
| | | * @param householdEntity |