|
|
@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
|
import org.springframework.data.redis.core.ReactiveRedisTemplate;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
|
import org.springframework.data.relational.core.query.Query;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
@@ -457,14 +458,16 @@ public class PlanNewCommonOutController {
|
|
|
* 获取音频
|
|
|
*/
|
|
|
private Mono<Audio> getAudio(Long id) {
|
|
|
- if (Objects.isNull(id)) {
|
|
|
+ if (Objects.isNull(id) || id <= 0) {
|
|
|
return Mono.just(getAudio());
|
|
|
}
|
|
|
// 优先读缓存
|
|
|
- Mono<Object> obj = reactiveRedisTemplate.opsForValue().get(RedisKey.FISSION_AUDIO + id);
|
|
|
+ Mono<Object> obj = reactiveRedisTemplate.opsForValue().get(RedisKey.FISSION_AUDIO + id)
|
|
|
+ .switchIfEmpty(Mono.just(" "));
|
|
|
return obj.flatMap(val -> {
|
|
|
- if (val != null) {
|
|
|
- return Mono.just(JSON.parseObject(val.toString(), Audio.class));
|
|
|
+ if (val != null && StrUtil.isNotBlank(val.toString())) {
|
|
|
+ Audio audio = JSON.parseObject(val.toString(), Audio.class);
|
|
|
+ return Mono.just(audio);
|
|
|
} else {
|
|
|
return template.selectOne(Query.query(Criteria.where("id").is(id)), Audio.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频为空", id))))
|