| | |
| | | package org.springblade.modules.house.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springblade.modules.label.vo.LabelVO; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Region; |
| | |
| | | houseEntity.setHouseCode(IdUtils.getIdBy36()); |
| | | houseEntity.setSource(2); |
| | | } |
| | | // 网格处理 |
| | | importGridHandle(houseAndHoldExcel,houseEntity); |
| | | // 新增 |
| | | save(houseEntity); |
| | | }else { |
| | |
| | | one.setBuilding(houseAndHoldExcel.getBuilding()); |
| | | one.setArea(houseAndHoldExcel.getArea()); |
| | | one.setPropertyPrice(houseAndHoldExcel.getPropertyPrice()); |
| | | // 网格处理 |
| | | importGridHandle(houseAndHoldExcel,one); |
| | | // 更新 |
| | | updateById(one); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入是网格数据绑定处理 |
| | | * @param houseAndHoldExcel |
| | | * @param houseEntity |
| | | */ |
| | | public void importGridHandle(HouseAndHoldExcel houseAndHoldExcel, HouseEntity houseEntity) { |
| | | if (!Strings.isBlank(houseAndHoldExcel.getCommunityName()) && |
| | | !Strings.isBlank(houseAndHoldExcel.getGridName())){ |
| | | // 查询对应的网格信息 |
| | | GridEntity gridEntity = gridService.getGridInfoByParam(houseAndHoldExcel.getCommunityName(),houseAndHoldExcel.getGridName()); |
| | | if (null!=gridEntity){ |
| | | // 设置场所范围 |
| | | houseEntity.setGridId(gridEntity.getId()); |
| | | houseEntity.setGridCode(gridEntity.getGridCode()); |
| | | // 更新网格范围绑定 |
| | | GridRangeEntity gridRangeEntity = new GridRangeEntity(); |
| | | gridRangeEntity.setGridId(gridEntity.getId()); |
| | | gridRangeEntity.setGridCode(gridEntity.getGridCode()); |
| | | gridRangeEntity.setHouseCode(houseEntity.getHouseCode()); |
| | | UpdateWrapper<GridRangeEntity> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("house_code",houseEntity.getHouseCode()); |
| | | gridRangeService.update(gridRangeEntity,updateWrapper); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 住户标签处理 |
| | | * @param houseAndHoldExcel |
| | |
| | | * |
| | | * @param householdEntity |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveOrUpdateUser(HouseholdEntity householdEntity) { |
| | | if (null != householdEntity.getPhoneNumber() && !householdEntity.getPhoneNumber().equals("")) { |
| | | //根据手机号查询库里的数据 |
| | | User userParams = new User(); |
| | | userParams.setPhone(householdEntity.getPhoneNumber()); |
| | | User user = userService.getOne(Condition.getQueryWrapper(userParams)); |
| | | if (null != user) { |
| | | List<User> list = userService.getUserListByPhoneOrAccount(householdEntity.getPhoneNumber()); |
| | | if (list.size()>0) { |
| | | User user = list.get(0); |
| | | //如果用户存在,则该用户id绑定住户 |
| | | householdEntity.setAssociatedUserId(user.getId()); |
| | | // 判断用户是否包含了居民角色,不包含则需更新 |
| | |
| | | // 返回 |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 查询对应的社区编号 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getCommunityCode(Long id) { |
| | | return baseMapper.getCommunityCode(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有房屋总数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int getAllListTotal() { |
| | | return baseMapper.getAllListTotal(); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有的房屋 |
| | | * @param i |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<HouseVO> getAllList(int i, int size) { |
| | | return baseMapper.getAllList(i,size); |
| | | } |
| | | } |