lin
2024-03-11 c5a0d277347f9ecaaf934b648b6edf5b9119516b
Merge remote-tracking branch 'origin/master'
2 files modified
66 ■■■■ changed files
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java 63 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -387,9 +387,6 @@
        <if test="place.doorplateNum!=null and place.doorplateNum!=''">
            and jpr.doorplate_num = #{place.doorplateNum}
        </if>
        <if test="place.placeName!=null and place.placeName!=''">
            and jp.place_name = #{place.placeName}
        </if>
        limit 1
    </select>
src/main/java/org/springblade/modules/place/service/impl/PlaceServiceImpl.java
@@ -32,6 +32,8 @@
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.category.entity.CategoryEntity;
import org.springblade.modules.category.service.ICategoryService;
import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity;
import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService;
import org.springblade.modules.grid.entity.GridEntity;
@@ -44,6 +46,7 @@
import org.springblade.modules.house.entity.HouseholdEntity;
import org.springblade.modules.house.entity.UserHouseLabelEntity;
import org.springblade.modules.house.service.IHouseholdService;
import org.springblade.modules.label.entity.LabelEntity;
import org.springblade.modules.place.entity.*;
import org.springblade.modules.place.excel.NinePlaceExcel;
import org.springblade.modules.place.excel.PlaceAndRelExcel;
@@ -57,6 +60,7 @@
import org.springblade.modules.police.service.IPoliceAffairsGridService;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.entity.Region;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IDictBizService;
@@ -734,6 +738,33 @@
    }
    /**
     * 保存场所详情信息
     *
     * @param placeEntity
     */
    @Transactional(rollbackFor = Exception.class)
    public void savePlaceExtInfo(PlaceEntity placeEntity) {
        PlaceExtEntity placeExtEntity = new PlaceExtEntity();
        placeExtEntity.setPlaceId(placeEntity.getId());
        // 判断是否已存在,已存在则不新增
        QueryWrapper<PlaceExtEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("is_deleted", 0)
            .eq("place_id", placeEntity.getId());
        PlaceExtEntity one = placeExtService.getOne(wrapper);
        if (null == one) {
            placeExtEntity.setPlaceId(placeEntity.getId());
            // 默认给待完善状态
            placeExtEntity.setConfirmFlag(4);
            placeExtEntity.setCreateTime(new Date());
            placeExtEntity.setUpdateTime(new Date());
            placeExtEntity.setCreateUser(AuthUtil.getUserId());
            placeExtEntity.setUpdateUser(AuthUtil.getUserId());
            // 新增场所详情
            placeExtService.save(placeExtEntity);
        }
    }
    /**
     * 历史场所挂接处理-临时
     *
     * @param place
@@ -904,8 +935,8 @@
        if (!Strings.isBlank(placeExcel.getPhoneNumber()) &&
            !Strings.isBlank(placeExcel.getName())) {
            PlaceVO placeVO = new PlaceVO();
            placeVO.setPhone(placeExcel.getPhoneNumber());
            placeVO.setUsername(placeExcel.getName());
            placeVO.setPrincipalPhone(placeExcel.getPhoneNumber());
            placeVO.setPrincipal(placeExcel.getName());
            // 更新场所负责人
            User user = bindUserHandle(placeVO);
            // 返回
@@ -946,12 +977,20 @@
                placeEntity.setSource(3);
                //一个一个插入,防止同一个表中有相同的数据
                save(placeEntity);
                // 插入详情
                savePlaceExtInfo(placeEntity);
                // 插入标签关系表
                savPlaceLabelBind(placeExcel, placeEntity);
                // 插入关联数据表
                PlaceRelEntity placeRelEntity = new PlaceRelEntity();
                placeRelEntity.setPlaceId(placeEntity.getId());
                placeRelEntity.setStreetName(placeExcel.getStreetName());
                QueryWrapper<Region> wrapper = new QueryWrapper<>();
                wrapper.eq("name",placeExcel.getCommunityName());
                Region region = SpringUtils.getBean(IRegionService.class).getOne(wrapper);
                if (null!=region){
                    placeRelEntity.setCommunityCode(region.getCode());
                }
                placeRelEntity.setCommunityName(placeExcel.getCommunityName());
                placeRelEntity.setGridName(placeExcel.getGridName());
                placeRelEntity.setBuildingName(placeExcel.getBuildingName());
@@ -978,6 +1017,8 @@
                placeEntity.setUpdateUser(AuthUtil.getUserId());
                //一个一个插入,防止同一个表中有相同的数据
                updateById(placeEntity);
                // 插入详情
                savePlaceExtInfo(placeEntity);
            }
        }
    }
@@ -989,11 +1030,19 @@
     */
    public void savPlaceLabelBind(PlaceAndRelExcel placeExcel, PlaceEntity placeEntity) {
        if (!Strings.isBlank(placeExcel.getLabelCode())) {
            PlaceVO placeVO = new PlaceVO();
            placeVO.setId(placeEntity.getId());
            placeVO.setLabel(placeExcel.getLabelCode());
            // 插入标签
            placeLabelBind(placeVO);
            // 匹配标签
            QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>();
            wrapper.eq("level",3).eq("category_name",placeExcel.getLabelCode()).eq("is_deleted",0);
            // 查询
            List<CategoryEntity> list = SpringUtils.getBean(ICategoryService.class).list(wrapper);
            if (list.size()>0){
                PlaceVO placeVO = new PlaceVO();
                CategoryEntity categoryEntity = list.get(0);
                placeVO.setLabel(categoryEntity.getCategoryNo());
                placeVO.setId(placeEntity.getId());
                // 插入标签
                placeLabelBind(placeVO);
            }
        }
    }