/* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ 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; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.modules.place.vo.PlaceVO; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 场所区域关联信息表(商超) 服务实现类 * * @author BladeX * @since 2023-11-20 */ @Service public class PlaceRelServiceImpl extends ServiceImpl implements IPlaceRelService { @Override public IPage selectPlaceRelPage(IPage page, PlaceRelVO placeRel) { return page.setRecords(baseMapper.selectPlaceRelPage(page, placeRel)); } /** * 查询地址编码信息(社区派出所相关信息) * @param place * @return */ @Override public DoorplateAddressEntity getDoorplateAddressEntity(PlaceVO place) { return baseMapper.getDoorplateAddressEntity(place); } /** * 商超数据处理 */ @Override public boolean mallDataHandle() { // 查询未处理的商超数据,将网格数据插入导入场所表 List list = baseMapper.getMallList(); // 遍历 for (PlaceRelEntity placeRelEntity : list) { // 查询对应的网格编号 QueryWrapper 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; } }