zhongrj
2024-03-14 04e128c3848c39b162fda4d0f45a0b10ed691fd3
src/main/java/org/springblade/modules/place/service/impl/PlaceRelServiceImpl.java
@@ -16,9 +16,15 @@
 */
package org.springblade.modules.place.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.utils.SpringUtils;
import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity;
import org.springblade.modules.grid.entity.GridEntity;
import org.springblade.modules.grid.service.IGridService;
import org.springblade.modules.place.entity.PlaceEntity;
import org.springblade.modules.place.entity.PlaceRelEntity;
import org.springblade.modules.place.service.IPlaceService;
import org.springblade.modules.place.vo.PlaceRelVO;
import org.springblade.modules.place.mapper.PlaceRelMapper;
import org.springblade.modules.place.service.IPlaceRelService;
@@ -26,6 +32,8 @@
import org.springblade.modules.place.vo.PlaceVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 场所区域关联信息表(商超) 服务实现类
@@ -50,4 +58,31 @@
   public DoorplateAddressEntity getDoorplateAddressEntity(PlaceVO place) {
      return baseMapper.getDoorplateAddressEntity(place);
   }
   /**
    * 商超数据处理
    */
   @Override
   public boolean mallDataHandle() {
      // 查询未处理的商超数据,将网格数据插入导入场所表
      List<PlaceRelEntity> list = baseMapper.getMallList();
      // 遍历
      for (PlaceRelEntity placeRelEntity : list) {
         // 查询对应的网格编号
         QueryWrapper<GridEntity> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("community_code",placeRelEntity.getCommunityCode())
            .eq("grid_name",placeRelEntity.getGridName())
         .eq("is_deleted",0);
         GridEntity gridEntity = SpringUtils.getBean(IGridService.class).getOne(queryWrapper);
         if (null!=gridEntity){
            PlaceEntity placeEntity = new PlaceEntity();
            placeEntity.setId(placeRelEntity.getPlaceId());
            placeEntity.setGridCode(gridEntity.getGridCode());
            placeEntity.setGridId(gridEntity.getId());
            // 更新
            SpringUtils.getBean(IPlaceService.class).updateById(placeEntity);
         }
      }
      return true;
   }
}