| | |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private IGridmanService gridmanService; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | | * @param page |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | if (null!=dept){ |
| | | place.setRegionCode(dept.getRegionCode()); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=place.getRoleName() && !place.getRoleName().equals("")){ |
| | | if (place.getRoleName().equals("网格员")){ |
| | |
| | | if (null!=placeVO.getGridId()){ |
| | | // 判断关联关系表是否存在 |
| | | QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("grid_id",placeVO.getGrid()).eq("house_code",placeVO.getHouseCode()); |
| | | wrapper.eq("house_code",placeVO.getHouseCode()); |
| | | GridRangeEntity one = gridRangeService.getOne(wrapper); |
| | | if (null==one){ |
| | | // 新增 |
| | |
| | | gridRangeEntity.setGridId(placeVO.getGridId()); |
| | | // 插入 |
| | | gridRangeService.save(gridRangeEntity); |
| | | }else { |
| | | // 修改绑定 |
| | | one.setGridId(placeVO.getGridId()); |
| | | // 修改 |
| | | gridRangeService.updateById(one); |
| | | } |
| | | }else { |
| | | // 判断网格员,查询对应网格人对应的网格id |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public User bindUserHandle(PlaceVO placeVO) { |
| | | User newUser = new User(); |
| | | if (null!=placeVO.getPhone() && !placeVO.getPhone().equals("")) { |
| | | placeVO.setPrincipal(placeVO.getUsername()); |
| | | placeVO.setPrincipalPhone(placeVO.getPhone()); |
| | | if (null!=placeVO.getPrincipalPhone() && !placeVO.getPrincipalPhone().equals("")) { |
| | | placeVO.setPrincipal(placeVO.getPrincipal()); |
| | | placeVO.setPrincipalPhone(placeVO.getPrincipalPhone()); |
| | | //根据手机号查询库里的数据 |
| | | User userParams = new User(); |
| | | userParams.setPhone(placeVO.getPhone()); |
| | | userParams.setPhone(placeVO.getPrincipalPhone()); |
| | | User user = userService.getOne(Condition.getQueryWrapper(userParams)); |
| | | |
| | | if (null!=user) { |
| | |
| | | } |
| | | } else { |
| | | //如果用户不存在,则新增一个用户 |
| | | newUser.setAccount(placeVO.getPhone()); |
| | | newUser.setPhone(placeVO.getPhone()); |
| | | newUser.setName(placeVO.getUsername()); |
| | | newUser.setRealName(placeVO.getUsername()); |
| | | newUser.setAccount(placeVO.getPrincipalPhone()); |
| | | newUser.setPhone(placeVO.getPrincipalPhone()); |
| | | newUser.setName(placeVO.getPrincipal()); |
| | | newUser.setRealName(placeVO.getPrincipal()); |
| | | // 社区群众部门 |
| | | newUser.setDeptId("1727979636479037441"); |
| | | // 目前暂定居民角色, |
| | |
| | | PlaceExtEntity one = placeExtService.getOne(wrapper); |
| | | if (null == one) { |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | placeExtEntity.setLocaltion(placeVO.getLocation()); |
| | | //新增 |
| | | placeExtService.savePlaceExt(placeExtEntity); |
| | | } |
| | |
| | | // 插入场所 |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setPlaceName(placeExcel.getPlaceName()); |
| | | placeEntity.setLocaltion(placeExcel.getAddress()); |
| | | placeEntity.setLocation(placeExcel.getAddress()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setPrincipal(placeExcel.getName()); |
| | | placeEntity.setPrincipalPhone(placeExcel.getPhoneNumber()); |
| | |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setId(one.getId()); |
| | | placeEntity.setPlaceName(placeExcel.getPlaceName()); |
| | | placeEntity.setLocaltion(placeExcel.getAddress()); |
| | | placeEntity.setLocation(placeExcel.getAddress()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | placeEntity.setCreateTime(new Date()); |
| | | placeEntity.setCreateUser(AuthUtil.getUserId()); |