| | |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.common.web.config.properties.CaptchaProperties; |
| | | import org.dromara.system.domain.SysClient; |
| | | import org.dromara.system.domain.SysUser; |
| | | import org.dromara.system.domain.vo.SysClientVo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | |
| | | * @param uuid 唯一标识 |
| | | */ |
| | | private void validateCaptcha(String tenantId, String username, String code, String uuid) { |
| | | String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, ""); |
| | | String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + StringUtils.blankToDefault(uuid, ""); |
| | | String captcha = RedisUtils.getCacheObject(verifyKey); |
| | | RedisUtils.deleteObject(verifyKey); |
| | | if (captcha == null) { |
| | |
| | | package org.dromara.common.redis.utils; |
| | | |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.redisson.api.*; |
| | | |
| | | import java.util.concurrent.CompletionStage; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.function.Consumer; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * 分布式队列工具 |
| | |
| | | /** |
| | | * 订阅阻塞队列(可订阅所有实现类 例如: 延迟 优先 有界 等) |
| | | */ |
| | | public static <T> void subscribeBlockingQueue(String queueName, Consumer<T> consumer, boolean isDelayed) { |
| | | public static <T> void subscribeBlockingQueue(String queueName, Function<T, CompletionStage<Void>> consumer, boolean isDelayed) { |
| | | RBlockingQueue<T> queue = CLIENT.getBlockingQueue(queueName); |
| | | if (isDelayed) { |
| | | // 订阅延迟队列 |
| | |
| | | package org.dromara.demo.controller.queue; |
| | | |
| | | import cn.dev33.satoken.annotation.SaIgnore; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.redis.utils.QueueUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.redis.utils.QueueUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | |
| | | QueueUtils.subscribeBlockingQueue(queueName, (String orderNum) -> { |
| | | // 观察接收时间 |
| | | log.info("通道: {}, 收到数据: {}", queueName, orderNum); |
| | | return CompletableFuture.runAsync(() -> { |
| | | // 异步处理数据逻辑 不要在上方处理业务逻辑 |
| | | log.info("数据处理: {}", orderNum); |
| | | }); |
| | | }, true); |
| | | return R.ok("操作成功"); |
| | | } |
| | |
| | | @DataColumn(key = "deptName", value = "dept_id"), |
| | | @DataColumn(key = "userName", value = "user_id") |
| | | }) |
| | | int deleteBatchIds(@Param(Constants.COLL) Collection<?> idList); |
| | | int deleteByIds(@Param(Constants.COLL) Collection<?> idList); |
| | | } |
| | |
| | | if (isValid) { |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (isValid) { |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void deleteGenTableByIds(Long[] tableIds) { |
| | | List<Long> ids = Arrays.asList(tableIds); |
| | | baseMapper.deleteBatchIds(ids); |
| | | baseMapper.deleteByIds(ids); |
| | | genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids)); |
| | | } |
| | | |
| | |
| | | if (CollUtil.isNotEmpty(delColumns)) { |
| | | List<Long> ids = StreamUtils.toList(delColumns, GenTableColumn::getColumnId); |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | | genTableColumnMapper.deleteBatchIds(ids); |
| | | genTableColumnMapper.deleteByIds(ids); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(isValid){ |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | if (isValid) { |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | } |
| | | CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey()); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(configIds)); |
| | | baseMapper.deleteByIds(Arrays.asList(configIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | CacheUtils.evict(CacheNames.SYS_DICT, dictType.getDictType()); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(dictIds)); |
| | | baseMapper.deleteByIds(Arrays.asList(dictIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int deleteLogininforByIds(Long[] infoIds) { |
| | | return baseMapper.deleteBatchIds(Arrays.asList(infoIds)); |
| | | return baseMapper.deleteByIds(Arrays.asList(infoIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int deleteNoticeByIds(Long[] noticeIds) { |
| | | return baseMapper.deleteBatchIds(Arrays.asList(noticeIds)); |
| | | return baseMapper.deleteByIds(Arrays.asList(noticeIds)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public int deleteOperLogByIds(Long[] operIds) { |
| | | return baseMapper.deleteBatchIds(Arrays.asList(operIds)); |
| | | return baseMapper.deleteByIds(Arrays.asList(operIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | SysOssConfig config = baseMapper.selectById(configId); |
| | | list.add(config); |
| | | } |
| | | boolean flag = baseMapper.deleteBatchIds(ids) > 0; |
| | | boolean flag = baseMapper.deleteByIds(ids) > 0; |
| | | if (flag) { |
| | | list.forEach(sysOssConfig -> |
| | | CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey())); |
| | |
| | | OssClient storage = OssFactory.instance(sysOss.getService()); |
| | | storage.delete(sysOss.getUrl()); |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除!", post.getPostName())); |
| | | } |
| | | } |
| | | return baseMapper.deleteBatchIds(Arrays.asList(postIds)); |
| | | return baseMapper.deleteByIds(Arrays.asList(postIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, ids)); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, ids)); |
| | | return baseMapper.deleteBatchIds(ids); |
| | | return baseMapper.deleteByIds(ids); |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new ServiceException("租户套餐已被使用"); |
| | | } |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | throw new ServiceException("超管租户不能删除"); |
| | | } |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | // 删除用户与岗位表 |
| | | userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId, ids)); |
| | | // 防止更新失败导致的数据删除 |
| | | int flag = baseMapper.deleteBatchIds(ids); |
| | | int flag = baseMapper.deleteByIds(ids); |
| | | if (flag < 1) { |
| | | throw new ServiceException("删除用户失败!"); |
| | | } |
| | |
| | | if (multiInstance == null && taskList.size() > 1) { |
| | | List<Task> tasks = StreamUtils.filter(taskList, e -> !e.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())); |
| | | if (CollUtil.isNotEmpty(tasks)) { |
| | | actHiTaskinstMapper.deleteBatchIds(StreamUtils.toList(tasks, Task::getId)); |
| | | actHiTaskinstMapper.deleteByIds(StreamUtils.toList(tasks, Task::getId)); |
| | | } |
| | | } |
| | | |
| | |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids) { |
| | | List<String> idList = StreamUtils.toList(ids, String::valueOf); |
| | | workflowService.deleteRunAndHisInstance(idList); |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (isValid) { |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Boolean deleteByIds(Collection<Long> ids) { |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | @Override |
| | | public Boolean deleteByIds(Collection<Long> ids) { |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Boolean deleteByIds(Collection<Long> ids) { |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | return baseMapper.deleteByIds(ids) > 0; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | | wfTaskBackNodeMapper.deleteBatchIds(ids); |
| | | wfTaskBackNodeMapper.deleteByIds(ids); |
| | | } |
| | | } |
| | | return true; |