mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 优化 替换过期方法
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -42,6 +43,10 @@ public class DelayedQueueController {
|
||||
QueueUtils.subscribeBlockingQueue(queueName, (String orderNum) -> {
|
||||
// 观察接收时间
|
||||
log.info("通道: {}, 收到数据: {}", queueName, orderNum);
|
||||
return CompletableFuture.runAsync(() -> {
|
||||
// 异步处理数据逻辑 不要在上方处理业务逻辑
|
||||
log.info("数据处理: {}", orderNum);
|
||||
});
|
||||
}, true);
|
||||
return R.ok("操作成功");
|
||||
}
|
||||
|
@ -55,5 +55,5 @@ public interface TestDemoMapper extends BaseMapperPlus<TestDemo, TestDemoVo> {
|
||||
@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);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,6 +83,6 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user