| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.flowable.idm.engine.impl.persistence.entity.UserEntity; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.cache.ParamCache; |
| | | import org.springblade.common.cache.SysCache; |
| | |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springblade.modules.auth.enums.UserEnum; |
| | | import org.springblade.modules.grid.service.IGridmanService; |
| | | import org.springblade.modules.property.service.IPropertyCompanyDistrictService; |
| | | import org.springblade.modules.system.entity.*; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.mapper.UserMapper; |
| | |
| | | import org.springblade.modules.system.service.IUserDeptService; |
| | | import org.springblade.modules.system.service.IUserOauthService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserDetailVO; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.system.wrapper.UserWrapper; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Override |
| | | public boolean updateUserInfo(User user) { |
| | | user.setPassword(null); |
| | | return updateById(user); |
| | | boolean b = updateById(user); |
| | | return b; |
| | | } |
| | | |
| | | private boolean submitUserDept(User user) { |
| | |
| | | userDeptList.add(userDept); |
| | | }); |
| | | userDeptService.remove(Wrappers.<UserDept>update().lambda().eq(UserDept::getUserId, user.getId())); |
| | | return userDeptService.saveBatch(userDeptList); |
| | | boolean b = userDeptService.saveBatch(userDeptList); |
| | | return b; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId) { |
| | | if (null == deptId && !AuthUtil.isAdministrator()){ |
| | | if (null == deptId && !AuthUtil.isAdministrator()) { |
| | | deptId = Long.parseLong(AuthUtil.getDeptId()); |
| | | } |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | |
| | | return userVO; |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询用户信息 |
| | | * |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UserVO> getUserListByParam(UserVO user) { |
| | | if (!Strings.isBlank(user.getRoleName())) { |
| | | // 查询对应的角色id |
| | | String roleIds = roleService.getRoleIds("000000", user.getRoleName()); |
| | | user.setRoleId(roleIds); |
| | | } |
| | | return baseMapper.getUserListByParam(user); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区Id搜索用户 |
| | | * |
| | | * @param districtId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> searchUserByDistrictId(String districtId) { |
| | | return baseMapper.searchUserByDistrictId(districtId); |
| | | } |
| | | |
| | | /** |
| | | * 根据手机号查询对应账号和手机号的用户信息 |
| | | * @param phoneNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> getUserListByPhoneOrAccount(String phoneNumber) { |
| | | return baseMapper.getUserListByPhoneOrAccount( phoneNumber); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public UserDetailVO getUserInfo(Long userId) { |
| | | // 根据用户id 获取用户详情信息 |
| | | UserDetailVO userVO = baseMapper.getUserInfo(userId); |
| | | if (null!=userVO){ |
| | | userVO.setPassword(null); |
| | | } |
| | | // 返回 |
| | | return userVO; |
| | | } |
| | | |
| | | @Override |
| | | public UserVO getuserById(Long id) { |
| | | return baseMapper.searchUserById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserEntity> getUserInfoByCode(String houseCode, String type) { |
| | | if (type.equals("0")) { |
| | | IGridmanService bean = SpringUtil.getBean(IGridmanService.class); |
| | | return bean.getGridManByCode(houseCode); |
| | | } else { |
| | | IPropertyCompanyDistrictService bean1 = SpringUtil.getBean(IPropertyCompanyDistrictService.class); |
| | | return bean1.getDistictUserByCode(houseCode); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<UserEntity> getUserInfoByDistrictId(String districtId, String building) { |
| | | return baseMapper.getUserInfoByDistrictId(districtId, building); |
| | | } |
| | | |
| | | /** |
| | | * 处理漏绑定的user_dept |
| | | */ |
| | | @Override |
| | | public Object handleUserDept() { |
| | | // 查询没有匹配的数据 |
| | | List<User> list = baseMapper.getNotBindUserDept(); |
| | | // 遍历处理 |
| | | for (User user : list) { |
| | | UserDept userDept = new UserDept(); |
| | | userDept.setUserId(user.getId()); |
| | | userDept.setDeptId(Long.parseLong(user.getDeptId())); |
| | | // 保存 |
| | | userDeptService.save(userDept); |
| | | } |
| | | return null; |
| | | } |
| | | } |