|
|
@@ -578,19 +578,24 @@ public class PlanNewCommonOutController {
|
|
|
if (Objects.isNull(id) || id <= 0) {
|
|
|
return Mono.just(getAudio());
|
|
|
}
|
|
|
+ return template.selectOne(Query.query(Criteria.where("id").is(id)), Audio.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频为空", id))))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::{}", id, throwable.getMessage()))));
|
|
|
+ // String value = redisTemplate.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 && 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))))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::", id, throwable.getMessage()))));
|
|
|
- }
|
|
|
- });
|
|
|
+ // Mono<String> obj = reactiveRedisTemplate.opsForValue().get(RedisKey.FISSION_AUDIO + id)
|
|
|
+ // .switchIfEmpty(Mono.just(" "))
|
|
|
+ // .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::", id, throwable.getMessage()))));
|
|
|
+ // return obj.flatMap(val -> {
|
|
|
+ // 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))))
|
|
|
+ // .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::", id, throwable.getMessage()))));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
private Audio getAudio() {
|
|
|
@@ -726,16 +731,12 @@ public class PlanNewCommonOutController {
|
|
|
PlanNewBackgroupPoster fxSetting = fm.getFxSetting();
|
|
|
goRequest = setNameVal(posterTemplate, fxSetting, fm.getSpare());
|
|
|
}
|
|
|
- QrcodeInfo stringBuilder = getQrcodeInfo(goRequest);
|
|
|
- Mono<QrcodeInfo> qrcodeInfoMono=Mono.just(new QrcodeInfo(null,null,null));
|
|
|
- List<Item> collect = goRequest.getItem()
|
|
|
- .stream()
|
|
|
- .filter(filter -> "cusqrcode".equals(filter.getT())
|
|
|
- && filter.getIsRandom()
|
|
|
- && 1 == filter.getType()).collect(Collectors.toList());
|
|
|
- if (!collect.isEmpty()) {
|
|
|
- qrcodeInfoMono = template.insert(stringBuilder)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("插入QrcodeInfo异常::::" + throwable.getMessage())));
|
|
|
+ String ret;
|
|
|
+ if (Objects.nonNull(goRequest)) {
|
|
|
+ ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
+ } else {
|
|
|
+
|
|
|
+ ret = goGenerateService.goGenerate(posterTemplate);
|
|
|
}
|
|
|
if (Objects.nonNull(ret)) {
|
|
|
JSONObject jsonObject1;
|
|
|
@@ -753,31 +754,11 @@ public class PlanNewCommonOutController {
|
|
|
} else {
|
|
|
fm.setFxGenerateImagesUrl(url);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- String ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
- if (Objects.nonNull(ret)) {
|
|
|
- JSONObject jsonObject1;
|
|
|
- try {
|
|
|
- jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BaseException(e.getMessage() + "---" + JSONUtil.parseObj(goRequest));
|
|
|
- }
|
|
|
- if (jsonObject1.containsKey("code") && jsonObject1.get("code", Integer.class) == 0 && jsonObject1.containsKey("data")) {
|
|
|
- JSONObject data = jsonObject1.get("data", JSONObject.class);
|
|
|
- if (data.containsKey("Url")) {
|
|
|
- String url = data.get("Url", String.class);
|
|
|
- if (Objects.nonNull(request.getWx_user_id()) && !request.getWx_user_id().isEmpty() && 3 != fm.getPlanNew().type()) {
|
|
|
- fm1.getT1().setQsGenerateImagesUrl(url);
|
|
|
- } else {
|
|
|
- fm1.getT1().setFxGenerateImagesUrl(url);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
- return Mono.just(fm);
|
|
|
- });
|
|
|
+ }
|
|
|
+ return Mono.just(fm);
|
|
|
});
|
|
|
return resMono1;
|
|
|
}
|