linwe
2024-05-29 c10d6358b9f014375a13821465bc978d0c0da22e
src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
@@ -346,7 +346,6 @@
         HouseholdEntity householdEntity = Objects.requireNonNull(BeanUtil.copy(houseHoldExcel, HouseholdEntity.class));
         // 判断姓名,手机号
         if (Strings.isBlank(householdEntity.getName())
            || Strings.isBlank(householdEntity.getPhoneNumber())
            || Strings.isBlank(householdEntity.getHouseCode())
         ) {
            errorNum++;
@@ -356,9 +355,8 @@
         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()));
@@ -444,7 +442,7 @@
            householdEntity.setMaritalStatus(Integer.parseInt(houseHoldExcel.getMaritalStatus()));
         }
         if (one==null){
         if (list.size()==0){
            // 新增
            this.save(householdEntity);
            importNum++;
@@ -453,13 +451,15 @@
         }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);
            }
         }
      }
@@ -470,7 +470,7 @@
         builder.append("其中有 ").append(updateNum).append(" 条数据已存在。");
      }
      if (errorNum>0){
         builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或手机号或门牌地址编码信息未导入!");
         builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或门牌地址编码信息未导入!");
      }
      return builder.toString();
   }