| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.PageDTO; |
| | | import com.panzhihua.common.model.dtos.community.ExportUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.NoticeReadDTO; |
| | | import com.panzhihua.common.model.dtos.user.EexcelUserDTO; |
| | | import com.panzhihua.common.model.dtos.user.PageFeedBackDTO; |
| | | import com.panzhihua.common.model.dtos.user.PageUserAppletsBackstageDTO; |
| | | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; |
| | | import com.panzhihua.common.model.dtos.user.*; |
| | | import com.panzhihua.common.model.vos.*; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.ActivityManagerVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.common.model.vos.user.*; |
| | | import com.panzhihua.common.utlis.IdCard; |
| | | import com.panzhihua.common.utlis.RealNameUtil; |
| | |
| | | return R.fail(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改用户志愿者状态 |
| | | * |
| | | * @param userId 志愿者用户ID |
| | | * @param type |
| | | */ |
| | | @Override |
| | | public R putUserIsVolunteerById(Long userId, int type) { |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | sysUserDO.setIsVolunteer(type); |
| | | sysUserDO.setUserId(userId); |
| | | |
| | | SysUserDO userInDB = userDao.selectById(userId); |
| | | if (userInDB != null) { |
| | | boolean isVol = userInDB.getIsVolunteer() == 1; |
| | | if (isVol) { |
| | | return R.fail("用户已是志愿者"); |
| | | } |
| | | if (userInDB.getType() != 1) { |
| | | return R.fail("用户不是小程序用户"); |
| | | } |
| | | int update = userDao.updateById(sysUserDO); |
| | | if (update > 0) { |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 用户绑定社区、小区 |
| | | * |
| | |
| | | //接入第三方实名认证 |
| | | String idCard = loginUserInfoVO.getIdCard(); |
| | | String name = loginUserInfoVO.getName(); |
| | | log.info("用户实名认证发送请求,姓名:" + name + "身份证号码:" + idCard); |
| | | boolean b = RealNameUtil.authentication(idCard, name); |
| | | if (!b) { |
| | | return R.fail("身份认证失败:公安系统认证错误"); |
| | |
| | | if (!ObjectUtils.isEmpty(comMngFamilyInfoDO1)) { |
| | | return R.fail("家庭成员已经存在"); |
| | | } |
| | | comMngFamilyInfoDO.setAge(IdCard.IdNOToAge(comMngFamilyInfoVO.getIdCard())); |
| | | int insert = comMngFamilyInfoDAO.insert(comMngFamilyInfoDO); |
| | | if (insert > 0) { |
| | | return R.ok(); |
| | |
| | | public R putFamily(ComMngFamilyInfoVO comMngFamilyInfoVO) { |
| | | ComMngFamilyInfoDO comMngFamilyInfoDO = new ComMngFamilyInfoDO(); |
| | | BeanUtils.copyProperties(comMngFamilyInfoVO, comMngFamilyInfoDO); |
| | | comMngFamilyInfoDO.setAge(IdCard.IdNOToAge(comMngFamilyInfoVO.getIdCard())); |
| | | int update = comMngFamilyInfoDAO.updateById(comMngFamilyInfoDO); |
| | | if (update > 0) { |
| | | return R.ok(); |
| | |
| | | Long communityId = administratorsUserVO.getCommunityId(); |
| | | //新增社区高级管理员角色 |
| | | SysRoleDO sysRoleDO = new SysRoleDO(); |
| | | if(roleId.intValue() == 999999999){ |
| | | if (roleId.intValue() == 999999999) { |
| | | sysRoleDO.setCommunityId(communityId); |
| | | sysRoleDO.setRoleName("超级管理员"); |
| | | sysRoleDO.setRoleKey("chaojiguanliyuan" + communityId); |
| | | }else{ |
| | | sysRoleDO.setRoleKey(Constants.ADMIN_SHOP_ROLE_KEY + communityId); |
| | | } else { |
| | | sysRoleDO.setCommunityId(0L); |
| | | sysRoleDO.setRoleName(administratorsUserVO.getShopStoreName()); |
| | | sysRoleDO.setRoleKey("shanghupingtai" + administratorsUserVO.getShopStorePhone()); |
| | | sysRoleDO.setRoleKey(Constants.SHOP_ROLE_KEY + administratorsUserVO.getShopStorePhone()); |
| | | } |
| | | sysRoleDO.setRoleSort(0); |
| | | sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); |
| | |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @Override |
| | | public R getSysUserVOByAccount(String account, Integer type) { |
| | | LambdaQueryWrapper<SysUserDO> query = new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getAccount, account); |
| | | query.eq(SysUserDO::getType, type); |
| | | SysUserDO sysUserDO = userDao.selectOne(query); |
| | | if (ObjectUtils.isEmpty(sysUserDO)) { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | SysUserVO sysUserVO = new SysUserVO(); |
| | | BeanUtils.copyProperties(sysUserDO, sysUserVO); |
| | | return R.ok(sysUserVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增SysUser |
| | | * |
| | | * @param storeVO 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addSysUser(ShopStoreVO storeVO) { |
| | | |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | Long communityId = 0L; |
| | | //新增社区高级管理员角色 |
| | | SysRoleDO sysRoleDO = new SysRoleDO(); |
| | | sysRoleDO.setCommunityId(0L); |
| | | sysRoleDO.setRoleName(storeVO.getName()); |
| | | sysRoleDO.setRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount()); |
| | | sysRoleDO.setRoleSort(0); |
| | | sysRoleDO.setCreateBy(storeVO.getLoginUserId()); |
| | | int insert = roleDAO.insert(sysRoleDO); |
| | | if (insert < 0) { |
| | | return R.fail(); |
| | | } |
| | | //新角色设置所有权限 |
| | | MenuRoleVO menuRoleVO = new MenuRoleVO(); |
| | | menuRoleVO.setIsAll(1); |
| | | menuRoleVO.setCommunityId(communityId); |
| | | menuRoleVO.setRoleId(sysRoleDO.getRoleId()); |
| | | this.putMenuRole(menuRoleVO); |
| | | |
| | | //sys_user 表 |
| | | String encode = new BCryptPasswordEncoder().encode(storeVO.getStorePassword()); |
| | | BeanUtils.copyProperties(storeVO, sysUserDO); |
| | | sysUserDO.setAccount(storeVO.getStoreAccount()); |
| | | sysUserDO.setType(5); |
| | | sysUserDO.setAreaId(null); |
| | | sysUserDO.setStatus(1); |
| | | sysUserDO.setPhone(storeVO.getPhone()); |
| | | sysUserDO.setName(storeVO.getContacts()); |
| | | sysUserDO.setPassword(encode); |
| | | try { |
| | | insert = userDao.insert(sysUserDO); |
| | | //把SysUserId赋值给店铺 |
| | | if (sysUserDO.getUserId() != null) { |
| | | userDao.updateStoreByPhone(storeVO.getPhone(), sysUserDO.getUserId()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("新增后台用户报错【{}】", e.getMessage()); |
| | | if (e.getMessage().contains("union_phone_type")) { |
| | | userDao.deleteStoreByPhoneAndStatus(storeVO.getPhone()); |
| | | roleDAO.deleteByRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount()); |
| | | return R.fail("手机号已经存在"); |
| | | } else if (e.getMessage().contains("union_account_type")) { |
| | | return R.fail("账户已经存在"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改SysUser用户信息 |
| | | * |
| | | * @param storeVO 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | @Override |
| | | public R editSysUser(ShopStoreVO storeVO) { |
| | | SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone, storeVO.getPhone()) |
| | | .eq(SysUserDO::getType, 5)); |
| | | if (sysUserDO1 == null) { |
| | | return R.fail("未查询到后台管理用户!"); |
| | | } |
| | | String encode = new BCryptPasswordEncoder().encode(storeVO.getStorePassword()); |
| | | sysUserDO1.setPassword(encode); |
| | | if (userDao.updateById(sysUserDO1) > 0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail("密码修改失败"); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户小程序首页活动提示 |
| | | * |
| | | * @param userEditTipsDTO 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | public R editUserTips(SysUserEditTipsDTO userEditTipsDTO) { |
| | | //查询用户信息 |
| | | SysUserDO userDO = userDao.selectById(userEditTipsDTO.getUserId()); |
| | | if (userDO == null) { |
| | | return R.fail("未查询到用户信息"); |
| | | } |
| | | //修改用户信息 |
| | | userDO.setIsTips(userEditTipsDTO.getIsTips()); |
| | | userDao.updateById(userDO); |
| | | if (userDao.updateById(userDO) > 0) { |
| | | return R.ok(); |
| | | } else { |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public R getUserArchives(Long userId) { |
| | | //查询用户信息 |
| | | SysUserDO userDO = userDao.selectById(userId); |
| | | if (userDO == null) { |
| | | return R.fail("未查询到用户信息"); |
| | | } |
| | | UserArchivesVO userArchivesVO = new UserArchivesVO(); |
| | | BeanUtils.copyProperties(userDO, userArchivesVO); |
| | | userArchivesVO.setUserId(userDO.getUserId()); |
| | | return R.ok(userArchivesVO); |
| | | } |
| | | |
| | | @Override |
| | | public R updateUserArchives(UpdateUserArchivesVO userArchivesVO) { |
| | | if(userArchivesVO.getUserId()==null){ |
| | | return R.fail("未查询到用户信息"); |
| | | } |
| | | userDao.updateUserArchives(userArchivesVO); |
| | | return R.ok(); |
| | | } |
| | | } |