linwei
2024-01-08 ad2ec97fe0c60eee4bb7c8cdacff7c876f280ea7
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -357,8 +357,8 @@
         // 处理单个
         String labelCode = labelList.get(0);
         // 切割成三个,分别是大类,中类,小类
         String bigString = labelCode.substring(0,2);
         String midString = labelCode.substring(0,4);
         String bigString = labelCode.substring(0, 2);
         String midString = labelCode.substring(0, 4);
         // 大类
         PlacePoiLabel big = new PlacePoiLabel();
         big.setPlaceId(placeVO.getId());
@@ -372,7 +372,7 @@
         mid.setType(2);
         placePoiLabelService.save(mid);
         // 处理小类
         if (labelCode.length()>4) {
         if (labelCode.length() > 4) {
            // 小类
            PlacePoiLabel min = new PlacePoiLabel();
            min.setPlaceId(placeVO.getId());
@@ -396,7 +396,14 @@
         //根据手机号查询库里的数据
         User userParams = new User();
         userParams.setPhone(placeVO.getPrincipalPhone());
         userParams.setIsDeleted(0);
         User user = userService.getOne(Condition.getQueryWrapper(userParams));
         if (null==user){
            User userParams1 = new User();
            userParams1.setAccount(placeVO.getPrincipalPhone());
            userParams1.setIsDeleted(0);
            user = userService.getOne(Condition.getQueryWrapper(userParams1));
         }
         if (null!=user) {
            //如果用户存在,则该用户id绑定场所
@@ -447,8 +454,19 @@
      PlaceExtEntity one = placeExtService.getOne(wrapper);
      if (null == one) {
         placeExtEntity.setPlaceId(placeVO.getId());
         //新增
         placeExtService.savePlaceExt(placeExtEntity);
         if (!Strings.isBlank(placeVO.getPrincipalPhone())) {
            // 待审核
            placeExtEntity.setConfirmFlag(1);
         }else {
            // 待完善
            placeExtEntity.setConfirmFlag(4);
         }
         placeExtEntity.setCreateTime(new Date());
         placeExtEntity.setUpdateTime(new Date());
         placeExtEntity.setCreateUser(AuthUtil.getUserId());
         placeExtEntity.setUpdateUser(AuthUtil.getUserId());
         // 新增场所详情
         placeExtService.save(placeExtEntity);
      }
   }
@@ -527,7 +545,7 @@
               List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper);
               if (list.size() > 0) {
                  placeVO.setDoorplateAddressEntity(list.get(0));
                  placeVO.setNeiCode(list.get(0).getNeiCode().replaceAll("0+$", ""));
                  placeVO.setNeiCode(list.get(0).getNeiCode());
               }
               // 查询网格数据
               GridVO gridVO = gridService.getGridDetailByHouseCode(place.getHouseCode());
@@ -620,6 +638,7 @@
    * @param isCovered
    */
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void importAndRelPlace(List<PlaceAndRelExcel> data, Boolean isCovered) {
      for (PlaceAndRelExcel placeExcel : data) {
         // 判断是否存在,不存在则插入,否则不操作
@@ -638,6 +657,10 @@
            placeEntity.setCreateUser(AuthUtil.getUserId());
            placeEntity.setUpdateTime(new Date());
            placeEntity.setUpdateUser(AuthUtil.getUserId());
            // 并生成36位的houseCode
            placeEntity.setHouseCode(IdUtils.getIdBy36());
            // 商超数据
            placeEntity.setSource(3);
            //一个一个插入,防止同一个表中有相同的数据
            save(placeEntity);
            // 插入标签关系表
@@ -807,4 +830,26 @@
      }
      return null;
   }
   /**
    * 商超数据处理
    * @return
    */
   @Override
   public Object placeAndRelHandle() {
      // 查询未处理的商超数据
      List<PlaceEntity> placeEntityList = baseMapper.placeAndRelHandle();
      // 处理
      for (PlaceEntity placeEntity : placeEntityList) {
         if (Strings.isBlank(placeEntity.getHouseCode())){
            // 并生成36位的houseCode
            placeEntity.setHouseCode(IdUtils.getIdBy36());
            // 商超数据
            placeEntity.setSource(3);
            // 更新
            updateById(placeEntity);
         }
      }
      return null;
   }
}