| | |
| | | package com.ycl.service.user.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.util.PageUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.druid.sql.PagerUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.bo.AdminUserDetails; |
| | | import com.ycl.dto.UmsAdminParam; |
| | | import com.ycl.dto.user.UmsUserDto1; |
| | | import com.ycl.dto.UpdateAdminPasswordParam; |
| | | import com.ycl.entity.depart.UmsDepart; |
| | | import com.ycl.entity.user.*; |
| | |
| | | import com.ycl.utils.SpringUtil; |
| | | import com.ycl.utils.common.LiveTimeMillisecond; |
| | | import com.ycl.utils.common.MacUtils; |
| | | import com.ycl.utils.common.PojoUtils; |
| | | import com.ycl.utils.common.RandomUtils; |
| | | import com.ycl.utils.redis.RedisKey; |
| | | import com.ycl.vo.user.UserVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.function.Consumer; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private RedisService redisService; |
| | | @Resource |
| | | private UmsDepartManageMapper umsDepartManageMapper; |
| | | @Resource |
| | | UmsRoleMenuRelationMapper umsRoleMenuRelationMapper; |
| | | @Resource |
| | | AdminMenuRelationMapper adminMenuRelationMapper; |
| | | @Resource |
| | | UmsMenuMapper umsMenuMapper; |
| | | |
| | | @Override |
| | | public UmsAdmin getAdminByUsername(String username) { |
| | | UmsAdmin admin = getCacheService().getAdmin(username); |
| | | if (admin != null) return admin; |
| | | // UmsAdmin admin = getCacheService().getAdmin(username); |
| | | // if (admin != null) return admin; |
| | | UmsAdmin admin = null; |
| | | QueryWrapper<UmsAdmin> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(UmsAdmin::getUsername, username); |
| | | List<UmsAdmin> adminList = list(wrapper); |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public UmsAdmin register(UmsAdminParam umsAdminParam) { |
| | | UmsAdmin umsAdmin = new UmsAdmin(); |
| | | //TODO mac,ip,职务,用户类型 |
| | | BeanUtils.copyProperties(umsAdminParam, umsAdmin); |
| | | umsAdmin.setCreateTime(new Date()); |
| | | umsAdmin.setStatus(1); |
| | | // umsAdmin.setMacAddress(MacUtils.getMac()); |
| | | //查询是否有相同用户名的用户 |
| | | QueryWrapper<UmsAdmin> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(UmsAdmin::getUsername, umsAdmin.getUsername()); |
| | | if (umsAdmin.getId() != null) { |
| | | wrapper.lambda().ne(UmsAdmin::getId, umsAdmin.getId()); |
| | | } |
| | | List<UmsAdmin> umsAdminList = list(wrapper); |
| | | if (umsAdminList.size() > 0) { |
| | | return null; |
| | | } |
| | | //将密码进行加密操作 |
| | | String encodePassword = passwordEncoder.encode(umsAdmin.getPassword()); |
| | | |
| | | if (umsAdmin.getId() == null && !umsAdmin.getPassword().matches("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$")) { |
| | | Asserts.fail("密码长度8到16位且密码中的字符必须包含字母(大写或者小写)和必须包含数字,不能包含空格"); |
| | | } |
| | | if (umsAdmin.getUsername().equals(umsAdmin.getPassword())) { |
| | | Asserts.fail("密码不能和登录名完全一致"); |
| | | } |
| | | umsAdmin.setPassword(encodePassword); |
| | | if (umsAdminParam.getDays() != null) { |
| | | Date date = new Date(); |
| | | Calendar calendar = new GregorianCalendar(); |
| | | calendar.setTime(date); |
| | | // 把日期往后增加一天,整数 往后推,负数往前移动 |
| | | calendar.add(Calendar.DATE, umsAdminParam.getDays()); |
| | | // 这个时间就是日期往后推一天的结果 |
| | | date = calendar.getTime(); |
| | | umsAdmin.setExpirationDate(date); |
| | | } else { |
| | | umsAdmin.setExpirationDate(new Date(2090, 1, 1)); |
| | | } |
| | | if (umsAdmin.getId() != null) { |
| | | baseMapper.updateById(umsAdmin); |
| | | } else { |
| | | baseMapper.insert(umsAdmin); |
| | | } |
| | | |
| | | LambdaQueryWrapper<UmsAdminRoleRelation> deleteWrapper = new QueryWrapper<UmsAdminRoleRelation>().lambda() |
| | | .eq(UmsAdminRoleRelation::getAdminId, umsAdmin.getId()); |
| | | |
| | | umsAdminRoleRelationService.remove(deleteWrapper); |
| | | //添加角色授权 |
| | | List<Long> ids = umsAdminParam.getRoleIds(); |
| | | if (!ids.isEmpty()) { |
| | | List<UmsAdminRoleRelation> roleIds = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | UmsAdminRoleRelation urr = new UmsAdminRoleRelation(); |
| | | urr.setAdminId(umsAdmin.getId()); |
| | | urr.setRoleId(id); |
| | | roleIds.add(urr); |
| | | } |
| | | umsAdminRoleRelationService.saveBatch(roleIds); |
| | | } |
| | | |
| | | umsDepartManageMapper.deletedByDepartId(umsAdmin.getId()); |
| | | |
| | | //添加部门 |
| | | UmsDepartManage departManage = new UmsDepartManage(); |
| | | departManage.setUserId(umsAdmin.getId()); |
| | | departManage.setDepartId(umsAdminParam.getDepartmentId()); |
| | | departManage.setCreateTime(new Date()); |
| | | departManage.setUpdateTime(new Date()); |
| | | umsDepartManageMapper.insert(departManage); |
| | | |
| | | // baseMapper.updateById(umsAdmin); |
| | | return umsAdmin; |
| | | } |
| | | |
| | | @Override |
| | | public void importExcl(UmsAdminParam umsAdminParam) { |
| | | UmsAdmin umsAdmin = new UmsAdmin(); |
| | | BeanUtils.copyProperties(umsAdminParam, umsAdmin); |
| | | umsAdmin.setCreateTime(new Date()); |
| | | umsAdmin.setStatus(1); |
| | |
| | | wrapper.lambda().eq(UmsAdmin::getUsername, umsAdmin.getUsername()); |
| | | List<UmsAdmin> umsAdminList = list(wrapper); |
| | | if (umsAdminList.size() > 0) { |
| | | return null; |
| | | throw new RuntimeException("用户已存在"); |
| | | } |
| | | //将密码进行加密操作 |
| | | String encodePassword = passwordEncoder.encode(umsAdmin.getPassword()); |
| | | |
| | | if (!umsAdmin.getPassword().matches("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$")) { |
| | | Asserts.fail("密码长度8到16位且密码中的字符必须包含字母(大写或者小写)和必须包含数字,不能包含空格"); |
| | | } |
| | | if (umsAdmin.getUsername().equals(umsAdmin.getPassword())) { |
| | | Asserts.fail("密码不能和登录名完全一致"); |
| | | } |
| | | umsAdmin.setPassword(encodePassword); |
| | | baseMapper.insert(umsAdmin); |
| | | |
| | |
| | | List<Long> ids = umsAdminParam.getRoleIds(); |
| | | if (!ids.isEmpty()) { |
| | | List<UmsAdminRoleRelation> roleIds = new ArrayList<>(); |
| | | for(Long id:ids){ |
| | | for (Long id : ids) { |
| | | UmsAdminRoleRelation urr = new UmsAdminRoleRelation(); |
| | | urr.setAdminId(umsAdmin.getId()); |
| | | urr.setRoleId(id); |
| | | roleIds.add(urr); |
| | | } |
| | | } |
| | | umsAdminRoleRelationService.saveBatch(roleIds); |
| | | } |
| | | //绑定菜单于用户 |
| | | if (!ids.isEmpty()) { |
| | | ArrayList<UmsRoleMenuRelation> umsRoleMenuRelations = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | umsRoleMenuRelations.addAll(umsRoleMenuRelationMapper |
| | | .selectList(new LambdaQueryWrapper<UmsRoleMenuRelation>() |
| | | .eq(UmsRoleMenuRelation::getRoleId, id))); |
| | | } |
| | | umsRoleMenuRelations |
| | | .stream() |
| | | .map(item -> item.getMenuId()) |
| | | .collect(Collectors.toList()) |
| | | .stream() |
| | | .distinct() |
| | | .collect(Collectors.toList()) |
| | | .stream() |
| | | .forEach(item -> { |
| | | AdminMenuRelation adminMenuRelation = new AdminMenuRelation(); |
| | | adminMenuRelation.setAdminId(umsAdmin.getId()); |
| | | adminMenuRelation.setMenuId(item); |
| | | adminMenuRelationMapper.insert(adminMenuRelation); |
| | | }); |
| | | } |
| | | //对用户名系统默认添加 |
| | | umsAdmin.setNickName(RandomUtils.getUserId(umsAdmin.getId())); |
| | | baseMapper.updateById(umsAdmin); |
| | | //umsAdmin.setNickName(RandomUtils.getUserId(umsAdmin.getId())); |
| | | //添加部门 |
| | | UmsDepartManage departManage = new UmsDepartManage(); |
| | | departManage.setUserId(umsAdmin.getId()); |
| | | departManage.setDepartId(umsAdminParam.getDepartmentId()); |
| | | departManage.setCreateTime(new Date()); |
| | | departManage.setUpdateTime(new Date()); |
| | | umsDepartManageMapper.insert(departManage); |
| | | |
| | | return umsAdmin; |
| | | baseMapper.updateById(umsAdmin); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //密码需要客户端加密后传递 |
| | | try { |
| | | AdminUserDetails userDetails = (AdminUserDetails) loadUserByUsername(username); |
| | | |
| | | UmsAdmin admin = userDetails.getUmsAdmin(); |
| | | LocalDateTime nowTime = LocalDateTime.now(); |
| | | nowTime = nowTime.plusMinutes(-15); |
| | | if (admin.getPasswordErrorNum() != null && admin.getPasswordErrorNum() >= 5 |
| | | && admin.getPasswordErrorLastTime().isAfter(nowTime)) { |
| | | admin.setPasswordErrorLastTime(LocalDateTime.now()); |
| | | updateById(admin); |
| | | Asserts.fail("登录失败超过5次,此账号被锁定,请15分钟后再试。"); |
| | | } |
| | | if (!passwordEncoder.matches(password, userDetails.getPassword())) { |
| | | if (admin.getPasswordErrorNum() == null) { |
| | | admin.setPasswordErrorNum(1); |
| | | } else { |
| | | admin.setPasswordErrorNum(admin.getPasswordErrorNum() + 1); |
| | | } |
| | | admin.setPasswordErrorLastTime(LocalDateTime.now()); |
| | | updateById(admin); |
| | | Asserts.fail("密码不正确"); |
| | | } |
| | | if (!userDetails.isEnabled()) { |
| | | Asserts.fail("帐号已被禁用"); |
| | | } |
| | | admin.setPasswordErrorNum(0); |
| | | updateById(admin); |
| | | |
| | | UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | //根据用户id,用户姓名 |
| | | token = jwtTokenUtil.generateToken(userDetails.getUserId(), userDetails.getUsername()); |
| | | redisService.set(RedisKey.PLATFORM_TOKEN_KEY.concat(username), token, LiveTimeMillisecond.s7200.time); |
| | | // updateLoginTimeByUsername(username); |
| | | insertLoginLog(username); |
| | | //insertLoginLog(username); |
| | | } catch (AuthenticationException e) { |
| | | LOGGER.warn("登录异常:{}", e.getMessage()); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | @Override |
| | | public String getOAuthToken(String username) { |
| | | String token = null; |
| | | //密码需要客户端加密后传递 |
| | | try { |
| | | AdminUserDetails userDetails = (AdminUserDetails) loadUserByUsername(username); |
| | | UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | //根据用户id,用户姓名 |
| | | token = jwtTokenUtil.generateToken(userDetails.getUserId(), userDetails.getUsername()); |
| | | redisService.set(RedisKey.PLATFORM_TOKEN_KEY.concat(username), token, LiveTimeMillisecond.s7200.time); |
| | | // updateLoginTimeByUsername(username); |
| | | //insertLoginLog(username); |
| | | } catch (AuthenticationException e) { |
| | | LOGGER.warn("登录异常:{}", e.getMessage()); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UmsResource> getResourceList(Long adminId) { |
| | | List<UmsResource> resourceList = getCacheService().getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(resourceList)) { |
| | | return resourceList; |
| | | public List<UmsMenu> getResourceList(Long adminId) { |
| | | List<UmsMenu> umsMenuList = getCacheService().getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(umsMenuList)) { |
| | | return umsMenuList; |
| | | } |
| | | resourceList = umsResourceMapper.getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(resourceList)) { |
| | | getCacheService().setResourceList(adminId, resourceList); |
| | | } |
| | | return resourceList; |
| | | umsMenuList = umsMenuMapper.getMenuList(adminId); |
| | | getCacheService().setResourceList(adminId, umsMenuList); |
| | | return umsMenuList; |
| | | } |
| | | |
| | | @Override |
| | | public int updatePassword(UpdateAdminPasswordParam param) { |
| | | if (StrUtil.isEmpty(param.getUsername()) |
| | | || StrUtil.isEmpty(param.getOldPassword()) |
| | | || StrUtil.isEmpty(param.getNewPassword())) { |
| | | if (StrUtil.isNotEmpty(param.getUsername()) |
| | | && StrUtil.isNotEmpty(param.getOldPassword()) |
| | | && StrUtil.isNotEmpty(param.getNewPassword()) |
| | | && !param.getNewPassword().matches("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$")) { |
| | | return -1; |
| | | } |
| | | if (param.getUsername().equals(param.getNewPassword())) { |
| | | return -4; |
| | | } |
| | | QueryWrapper<UmsAdmin> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(UmsAdmin::getUsername, param.getUsername()); |
| | |
| | | //获取用户信息 |
| | | UmsAdmin admin = getAdminByUsername(username); |
| | | if (admin != null) { |
| | | List<UmsResource> resourceList = getResourceList(admin.getId()); |
| | | if (admin.getExpirationDate() != null) { |
| | | if (!admin.getExpirationDate().after(new Date())) { |
| | | Asserts.fail("账号已过期请联系管理员"); |
| | | } |
| | | } |
| | | List<UmsMenu> resourceList = getResourceList(admin.getId()); |
| | | return new AdminUserDetails(admin, resourceList); |
| | | } |
| | | throw new UsernameNotFoundException("用户名或密码错误"); |
| | | throw new UsernameNotFoundException("用户不存在"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<UmsAdmin> pageUser(UserVO.PageUserVO pageUserVO) { |
| | | public Page<UmsAdmin> pageUser(UserVO.PageUserVO pageUserVO) { |
| | | int pageSize = pageUserVO.getPageSize(); |
| | | int current = pageUserVO.getCurrent(); |
| | | Page<UmsAdmin> page = new Page<>(current, pageSize); |
| | | LambdaQueryWrapper<UmsAdmin> queryWrapper = new LambdaQueryWrapper<>(); |
| | | /* LambdaQueryWrapper<UmsAdmin> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if (StringUtils.isNotBlank(pageUserVO.getKeyword())) { |
| | | queryWrapper.like(UmsAdmin::getUsername, pageUserVO.getKeyword()) |
| | |
| | | } |
| | | if (PojoUtils.Vo.isUsefulSearchParam(pageUserVO.getUserType())) { |
| | | queryWrapper.eq(UmsAdmin::getUserType, pageUserVO.getUserType()); |
| | | }*/ |
| | | UmsAdmin umsAdmin = new UmsAdmin(); |
| | | if (pageUserVO.getUserType() != null) { |
| | | umsAdmin.setUserType(pageUserVO.getUserType()); |
| | | } |
| | | if (PojoUtils.Vo.isUsefulSearchParam(pageUserVO.getDepartmentId())) { |
| | | queryWrapper.eq(UmsAdmin::getDepartmentId, pageUserVO.getDepartmentId()); |
| | | if (pageUserVO.getKeyword() != null && !("".equals(pageUserVO.getKeyword()))) { |
| | | umsAdmin.setKeyword(pageUserVO.getKeyword()); |
| | | } |
| | | Page<UmsAdmin> page1 = baseMapper.selectPage(page, queryWrapper); |
| | | List<UmsAdmin> records = page1.getRecords(); |
| | | if (CollUtil.isNotEmpty(records)) { |
| | | records.forEach(e -> { |
| | | UmsDepart umsDepart = departService.getById(e.getDepartmentId()); |
| | | if (null != umsDepart) { |
| | | e.setDepartName(umsDepart.getDepartName()); |
| | | } |
| | | //获取角色列表 |
| | | List<UmsRole> roles = umsRoleMapper.getRoleList(e.getId()); |
| | | e.setRoles(roles); |
| | | }); |
| | | if (pageUserVO.getJobTitle() != null && !("".equals(pageUserVO.getJobTitle()))) { |
| | | umsAdmin.setJobTitle(pageUserVO.getJobTitle()); |
| | | } |
| | | return page1; |
| | | PageUtil.setFirstPageNo(1); |
| | | int offset = PageUtil.getStart(current, pageSize); |
| | | List<UmsAdmin> list = baseMapper.selectCondList(umsAdmin, offset, pageSize); |
| | | Long total = baseMapper.selectCondTotal(umsAdmin); |
| | | page.setRecords(list); |
| | | page.setTotal(total); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | | public List<UmsUserDto1> userExp() { |
| | | List<UmsAdmin> umsAdmins = baseMapper.selectToExp(); |
| | | List<UmsUserDto1> res = umsAdmins.stream() |
| | | .map(item -> { |
| | | UmsUserDto1 res1 = new UmsUserDto1(); |
| | | res1.setId(item.getId()); |
| | | res1.setUsername(item.getUsername()); |
| | | res1.setNickName(item.getNickName()); |
| | | res1.setMobile(item.getMobile()); |
| | | StringBuffer roleStrBuffer = new StringBuffer(); |
| | | List<UmsRole> roles = item.getRoles(); |
| | | roles.forEach(new Consumer<UmsRole>() { |
| | | @Override |
| | | public void accept(UmsRole o) { |
| | | roleStrBuffer.append(o.getName()); |
| | | roleStrBuffer.append(","); |
| | | } |
| | | }); |
| | | roleStrBuffer.deleteCharAt(roleStrBuffer.length() - 1); |
| | | res1.setRoles(roleStrBuffer.toString()); |
| | | StringBuffer departStrBuffer = new StringBuffer(); |
| | | List<UmsDepart> departs = item.getDepart(); |
| | | departs.forEach(new Consumer<UmsDepart>() { |
| | | @Override |
| | | public void accept(UmsDepart o) { |
| | | departStrBuffer.append(o.getDepartName()); |
| | | departStrBuffer.append(","); |
| | | } |
| | | }); |
| | | departStrBuffer.deleteCharAt(departStrBuffer.length() - 1); |
| | | res1.setDepart(departStrBuffer.toString()); |
| | | res1.setJobTitle(item.getJobTitle()); |
| | | Date createTime = item.getCreateTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (createTime != null) { |
| | | res1.setCreateTime(sdf.format(createTime)); |
| | | } |
| | | |
| | | Integer status = item.getStatus(); |
| | | if (status.equals(1)) { |
| | | res1.setStatus("启用"); |
| | | } else { |
| | | res1.setStatus("禁用"); |
| | | } |
| | | return res1; |
| | | }).collect(Collectors.toList()); |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public boolean updateStatusBatch(List<Long> ids, Integer status) { |
| | | List<UmsAdmin> users = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | UmsAdmin umsAdmin = UmsAdmin.builder(). |
| | | UmsAdmin umsAdmin = UmsAdmin.builder(). |
| | | id(id).status(status).build(); |
| | | users.add(umsAdmin); |
| | | } |
| | | updateBatchById(users,users.size()); |
| | | updateBatchById(users, users.size()); |
| | | getCacheService().delBatchAdmin(ids); |
| | | return true; |
| | | } |
| | |
| | | public List<UmsAdmin> getDepartUser(Long departId) { |
| | | QueryWrapper<UmsDepartManage> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(UmsDepartManage::getDepartId, departId); |
| | | List<UmsDepartManage> list = umsDepartManageMapper.selectList(wrapper); |
| | | List<Long> userIds = list.stream().map(UmsDepartManage::getUserId).collect(Collectors.toList()); |
| | | List<UmsDepartManage> list = umsDepartManageMapper.selectList(wrapper); |
| | | List<Long> userIds = list.stream().map(UmsDepartManage::getUserId).collect(Collectors.toList()); |
| | | QueryWrapper<UmsAdmin> wrapperUser = new QueryWrapper<>(); |
| | | wrapperUser.in("id", userIds); |
| | | List<UmsAdmin> adminList = baseMapper.selectList(wrapperUser); |
| | |
| | | QueryWrapper<UmsAdmin> wrapperUser = new QueryWrapper<>(); |
| | | wrapperUser.in("id", arr); |
| | | List<UmsAdmin> adminList = baseMapper.selectList(wrapperUser); |
| | | if (adminList == null||adminList.isEmpty()) { |
| | | if (adminList == null || adminList.isEmpty()) { |
| | | throw new ApiException("未查询到用户"); |
| | | } |
| | | if ("02".equals(sendType)) { |
| | | str = adminList.stream().map(UmsAdmin::getEmail).collect(Collectors.joining(",")); |
| | | str = adminList.stream().map(UmsAdmin::getEmail).collect(Collectors.joining(",")); |
| | | } else { |
| | | str = adminList.stream().map(UmsAdmin::getMobile).collect(Collectors.joining(",")); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | @Override |
| | | public UmsAdmin getByOpenid(String openid) { |
| | | LambdaQueryWrapper<UmsAdmin> wrapper = new LambdaQueryWrapper<UmsAdmin>().eq(UmsAdmin::getOpenid, openid).last("limit 1"); |
| | | |
| | | return baseMapper.selectOne(wrapper); |
| | | } |
| | | } |