update 优化 替换过期方法

This commit is contained in:
疯狂的狮子Li
2024-06-21 14:59:50 +08:00
parent 52598e5c5c
commit 6d2cc6e87d
28 changed files with 38 additions and 33 deletions

View File

@ -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("操作成功");
}

View File

@ -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);
}

View File

@ -101,7 +101,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
return baseMapper.deleteByIds(ids) > 0;
}
@Override

View File

@ -83,6 +83,6 @@ public class TestTreeServiceImpl implements ITestTreeService {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
return baseMapper.deleteByIds(ids) > 0;
}
}