| | |
| | | import com.fengdu.gas.repository.po.*; |
| | | import com.fengdu.gas.repository.vo.AdminRoleVO; |
| | | import com.fengdu.gas.repository.vo.AdminUserVO; |
| | | import com.wf.captcha.SpecCaptcha; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | private AdminPermissionService permissionService; |
| | | @Autowired |
| | | private AdminPowerService adminPowerService; |
| | | |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | |
| | | |
| | | // 添加后台管理员 |
| | |
| | | |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * 生成验证码图片并返回其 Base64 编码字符串 |
| | | * |
| | | * @param uuid 用于标识验证码的唯一标识符 |
| | | * @return 包含验证码图片 Base64 编码的响应结果 |
| | | */ |
| | | public ExecutedResult<String> generate(String uuid) { |
| | | SpecCaptcha specCaptcha = new SpecCaptcha(100, 30, 4); |
| | | // captcha.setCharType(Captcha.TYPE_DEFAULT); |
| | | String code = specCaptcha.text().toLowerCase(); |
| | | // 缓存验证码 |
| | | redisTemplate.opsForValue().set(uuid, code); |
| | | // 设置验证码3分钟后过期 |
| | | redisTemplate.expire(uuid, 3, TimeUnit.MINUTES); |
| | | return ExecutedResult.success(specCaptcha.toBase64()); |
| | | } |
| | | // 获取管理员权限列表 |
| | | public ExecutedResult<ResAdminPower> getPower(Long adminId) { |
| | | ResAdminPower result = new ResAdminPower(); |