| | |
| | | import org.springblade.modules.grid.service.IGridmanService; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.property.entity.PropertyCompanyEntity; |
| | | import org.springblade.modules.property.service.IPropertyCompanyDistrictService; |
| | | import org.springblade.modules.property.service.IPropertyCompanyService; |
| | |
| | | private final IUserOauthService userOauthService; |
| | | private final IRoleService roleService; |
| | | private final BladeTenantProperties tenantProperties; |
| | | private final IPoliceAffairsGridService policeAffairsGridService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | if (userCount > 0L && Func.isEmpty(user.getId())) { |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount())); |
| | | } |
| | | return save(user) && submitUserDept(user); |
| | | boolean save = save(user); |
| | | // 更新警格或网格的绑定 |
| | | updateGridBind(user); |
| | | // 返回 |
| | | return save && submitUserDept(user); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public boolean updateUserInfo(User user) { |
| | | user.setPassword(null); |
| | | boolean b = updateById(user); |
| | | // 更新警格或网格的绑定 |
| | | updateGridBind(user); |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * 更新警格或网格的绑定 |
| | | * @param user |
| | | */ |
| | | public void updateGridBind(User user) { |
| | | // 判断机构类型 |
| | | List<String> deptIds = Arrays.asList(user.getDeptId().split(",")); |
| | | for (String deptId : deptIds) { |
| | | // 查询对应的机构 |
| | | Dept dept = SpringUtil.getBean(IDeptService.class).getById(deptId); |
| | | if (null!=dept.getDeptNature() |
| | | && !Strings.isBlank(dept.getRegionCode()) |
| | | && dept.getDeptNature()==1 |
| | | ){ |
| | | QueryWrapper<PoliceAffairsGridEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("jw_grid_code",dept.getRegionCode()); |
| | | PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridService.getOne(wrapper); |
| | | // 更新 |
| | | if (null!=policeAffairsGridEntity){ |
| | | if (!Strings.isBlank(policeAffairsGridEntity.getPoliceUserId())) { |
| | | if (!policeAffairsGridEntity.getPoliceUserId().contains(user.getId().toString())) { |
| | | policeAffairsGridEntity.setPoliceUserId(policeAffairsGridEntity.getPoliceUserId() + "," + user.getId()); |
| | | // 解决更新报错 |
| | | policeAffairsGridEntity.setGeom(null); |
| | | // 更新 |
| | | SpringUtil.getBean(IPoliceAffairsGridService.class).updateById(policeAffairsGridEntity); |
| | | } |
| | | }else { |
| | | policeAffairsGridEntity.setPoliceUserId(user.getId().toString()); |
| | | // 解决更新报错 |
| | | policeAffairsGridEntity.setGeom(null); |
| | | // 更新 |
| | | SpringUtil.getBean(IPoliceAffairsGridService.class).updateById(policeAffairsGridEntity); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean submitUserDept(User user) { |
| | | List<Long> deptIdList = Func.toLongList(user.getDeptId()); |
| | | List<UserDept> userDeptList = new ArrayList<>(); |