| | |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.excel.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.HouseTenantExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.mapper.HouseholdMapper; |
| | | import org.springblade.modules.house.service.IHouseRentalService; |
| | |
| | | HouseholdEntity householdEntity = Objects.requireNonNull(BeanUtil.copy(houseHoldExcel, HouseholdEntity.class)); |
| | | // 判断姓名,手机号 |
| | | if (Strings.isBlank(householdEntity.getName()) |
| | | || Strings.isBlank(householdEntity.getPhoneNumber()) |
| | | || Strings.isBlank(householdEntity.getHouseCode()) |
| | | ) { |
| | | errorNum++; |
| | |
| | | QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code", householdEntity.getHouseCode()) |
| | | .eq("is_deleted", 0) |
| | | .eq("phone_number", householdEntity.getPhoneNumber()) |
| | | .eq("name", householdEntity.getName()); |
| | | HouseholdEntity one = this.getOne(wrapper); |
| | | List<HouseholdEntity> list = this.list(wrapper); |
| | | // 与角色关系 |
| | | if (!Strings.isBlank(houseHoldExcel.getRelationship())) { |
| | | householdEntity.setRelationship(Integer.parseInt(houseHoldExcel.getRelationship())); |
| | |
| | | if (houseRentalEntity != null) { |
| | | householdEntity.setHousingRentalId(houseRentalEntity.getId()); |
| | | } else { |
| | | errorNum++; |
| | | continue; |
| | | // 新建出租屋 |
| | | HouseRentalEntity houseRentalEntity1 = new HouseRentalEntity(); |
| | | houseRentalEntity1.setHouseCode(householdEntity.getHouseCode()); |
| | | houseRentalEntity1.setHouseStatus(1); |
| | | houseRentalEntity1.setAuditStatus(0); |
| | | houseRentalEntity1.setRentalUse(4); |
| | | houseRentalEntity1.setTenantRelationship(1); |
| | | houseRentalEntity1.setRentalTime(new Date()); |
| | | houseRentalEntity1.setDueTime(new Date()); |
| | | houseRentalEntity1.setTerminationTime(new Date()); |
| | | iHouseRentalService.save(houseRentalEntity1); |
| | | householdEntity.setHousingRentalId(houseRentalEntity1.getId()); |
| | | // errorNum++; |
| | | // continue; |
| | | } |
| | | } |
| | | /// 是否主要联系人 |
| | |
| | | householdEntity.setMaritalStatus(Integer.parseInt(houseHoldExcel.getMaritalStatus())); |
| | | } |
| | | |
| | | if (one==null){ |
| | | if (list.size()==0){ |
| | | // 新增 |
| | | this.save(householdEntity); |
| | | importNum++; |
| | |
| | | }else { |
| | | updateNum++; |
| | | if (isCovered){ |
| | | // 覆盖更新 |
| | | householdEntity.setId(one.getId()); |
| | | // 更新 |
| | | updateById(householdEntity); |
| | | for (HouseholdEntity one : list) { |
| | | // 覆盖更新 |
| | | householdEntity.setId(one.getId()); |
| | | // 更新 |
| | | updateById(householdEntity); |
| | | // 处理标签 |
| | | handleLabel(householdEntity,houseHoldExcel); |
| | | } |
| | | importNum++; |
| | | // 处理标签 |
| | | handleLabel(householdEntity,houseHoldExcel); |
| | | } |
| | | } |
| | | } |
| | |
| | | builder.append("其中有 ").append(updateNum).append(" 条数据已存在。"); |
| | | } |
| | | if (errorNum>0){ |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或手机号或门牌地址编码信息未导入!"); |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或门牌地址编码信息未导入!"); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询对应的住户集合 |
| | | * |
| | | * @param i |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<HouseholdVO> getAllList(int i, int size) { |
| | | return baseMapper.getAllList(i,size); |
| | | return baseMapper.getAllList(i, size); |
| | | } |
| | | |
| | | @Override |
| | | public List<HouseTenantExcel> exportTenant(HouseholdVO household) { |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(HouseholdVO.class, household); |
| | | List<HouseTenantExcel> houseTenantExcels = baseMapper.exportTenant(household, |
| | | commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList() |
| | | ); |
| | | return houseTenantExcels; |
| | | } |
| | | } |