|
|
@@ -82,7 +82,7 @@ public class GoGenerateService {
|
|
|
Mono<List<StringBuilder>> stringBuilderMono = getStringBuilderMono(goRequest);
|
|
|
|
|
|
Mono<Poster> posterMono1 = getPosterResMono1(Mono.just(posterRequset),
|
|
|
- getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()))
|
|
|
+ getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1(),getTextListsTitle()))
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
|
|
|
.onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
.flatMap(f -> template.insert(f));
|
|
|
@@ -101,7 +101,10 @@ public class GoGenerateService {
|
|
|
return template.select(Query.query(Criteria.where("type").is(14).and("deleted_at").isNull()), Material.class)
|
|
|
.collectList();
|
|
|
}
|
|
|
-
|
|
|
+ private Mono<List<Material>> getTextListsTitle() {
|
|
|
+ return template.select(Query.query(Criteria.where("type").is(6).and("deleted_at").isNull()), Material.class)
|
|
|
+ .collectList();
|
|
|
+ }
|
|
|
//背景
|
|
|
private Mono<List<Image>> getBgImage() {
|
|
|
return template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Image.class)
|
|
|
@@ -116,11 +119,11 @@ public class GoGenerateService {
|
|
|
* @return
|
|
|
*/
|
|
|
public Mono<String> getOutTemPosterYx(GoRequest goRequest,Mono<List<StringBuilder>> stringBuilderMono){
|
|
|
- return getStringMonoOut(goRequest, stringBuilderMono, getBgImageYx(), getFmImageListsYx(), getTextListsYx(),getImageTypeYx());
|
|
|
+ return getStringMonoOut(goRequest, stringBuilderMono, getBgImageYx(), getFmImageListsYx(), getTextListsYx(),getImageTypeYx(),getTextListsTitle());
|
|
|
}
|
|
|
|
|
|
public Mono<String> getOutTemPosterQs(GoRequest goRequest,Mono<List<StringBuilder>> stringBuilderMono){
|
|
|
- return getStringMonoOut(goRequest, stringBuilderMono, getBgImageQs(), getFmImageListsQs(), getTextListsQs(),getImageTypeQs());
|
|
|
+ return getStringMonoOut(goRequest, stringBuilderMono, getBgImageQs(), getFmImageListsQs(), getTextListsQs(),getImageTypeQs(),getTextListsTitle());
|
|
|
}
|
|
|
private Mono<List<Image>> getBgImageQs() {
|
|
|
return template.select(Query.query(Criteria.where("type").is(2).and("group_type").is(2).and("deleted_at").isNull()), Image.class).collectList();
|
|
|
@@ -154,9 +157,17 @@ public class GoGenerateService {
|
|
|
|
|
|
|
|
|
public Mono<String> getStringMonoOut(GoRequest goRequest, Mono<List<StringBuilder>> stringBuilderMono,
|
|
|
- Mono<List<Image>> bgImage, Mono<List<Image>> fmImage, Mono<List<Material>> text,Mono<List<Image>> fm1) {
|
|
|
+ Mono<List<Image>> bgImage, Mono<List<Image>> fmImage, Mono<List<Material>> text,Mono<List<Image>> fm1, Mono<List<Material>> title) {
|
|
|
+
|
|
|
+ Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1,title).flatMap(f -> {
|
|
|
|
|
|
- Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1).flatMap(f -> {
|
|
|
+ List<Material> t6 = f.getT6();
|
|
|
+ if (Objects.nonNull(t6) &&!t6.isEmpty()) {
|
|
|
+ Optional.ofNullable(t6.get(RandomUtil.randomInt(0,t6.size()))).ifPresent(material -> goRequest.getItem().stream()
|
|
|
+ .filter(ff -> "title".equals(ff.getT()) && ff.getIsRandom())
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(item -> {item.setV(material.content());}));
|
|
|
+ }
|
|
|
List<StringBuilder> t4 = f.getT4();
|
|
|
if (Objects.nonNull(t4) && !t4.isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("H5二维码"));
|
|
|
@@ -201,7 +212,7 @@ public class GoGenerateService {
|
|
|
*/
|
|
|
|
|
|
public Mono<String> saveAndUpdatePlanGenerateImage0(GoRequest goRequest, Mono<List<StringBuilder>> stringBuilderMono, ServiceGroupSettingItemRequest qsSetting, PlanReq saveRequest ){
|
|
|
- return saveAndUpdatePlanGenerateImage1(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1(), qsSetting, saveRequest);
|
|
|
+ return saveAndUpdatePlanGenerateImage1(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1(), qsSetting, saveRequest,getTextListsTitle());
|
|
|
}
|
|
|
/**
|
|
|
* 计划保存修改生成图片
|
|
|
@@ -215,9 +226,9 @@ public class GoGenerateService {
|
|
|
*/
|
|
|
public Mono<String> saveAndUpdatePlanGenerateImage1(GoRequest goRequest, Mono<List<StringBuilder>> stringBuilderMono,
|
|
|
Mono<List<Image>> bgImage, Mono<List<Image>> fmImage, Mono<List<Material>> text,Mono<List<Image>> fm1,
|
|
|
- ServiceGroupSettingItemRequest qsSetting,PlanReq saveRequest) {
|
|
|
+ ServiceGroupSettingItemRequest qsSetting,PlanReq saveRequest,Mono<List<Material>> title) {
|
|
|
|
|
|
- Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1,getStringBuilderMono(saveRequest)).flatMap(f -> {
|
|
|
+ Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1,getStringBuilderMono(saveRequest),title).flatMap(f -> {
|
|
|
List<StringBuilder> t4 = f.getT4();
|
|
|
if (Objects.nonNull(t4) && !t4.isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("H5二维码"));
|
|
|
@@ -230,6 +241,13 @@ public class GoGenerateService {
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
}
|
|
|
+ List<Material> t7 = f.getT7();
|
|
|
+ if (Objects.nonNull(t7) &&!t7.isEmpty()) {
|
|
|
+ Optional.ofNullable(t7.get(RandomUtil.randomInt(0,t7.size()))).ifPresent(material -> goRequest.getItem().stream()
|
|
|
+ .filter(ff -> "title".equals(ff.getT()) && ff.getIsRandom())
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(item -> {item.setV(material.content());}));
|
|
|
+ }
|
|
|
//封面
|
|
|
if( Objects.nonNull(f.getT5()) &&!f.getT5().isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst()
|
|
|
@@ -373,16 +391,27 @@ public class GoGenerateService {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private Mono<String> getStringMono(GoRequest goRequest, Mono<List<StringBuilder>> stringBuilderMono,
|
|
|
- Mono<List<Image>> bgImage, Mono<List<Image>> fmImage, Mono<List<Material>> text,Mono<List<Image>> fm1) {
|
|
|
- Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1).flatMap(f -> {
|
|
|
+ Mono<List<Image>> bgImage,
|
|
|
+ Mono<List<Image>> fmImage,
|
|
|
+ Mono<List<Material>> text,
|
|
|
+ Mono<List<Image>> fm1,
|
|
|
+ Mono<List<Material>> textTitle
|
|
|
+ ) {
|
|
|
+ Mono<String> stringMono = Mono.zip(bgImage, fmImage, text, stringBuilderMono,fm1,textTitle).flatMap(f -> {
|
|
|
List<StringBuilder> t4 = f.getT4();
|
|
|
if (Objects.nonNull(t4) && !t4.isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("H5二维码"));
|
|
|
}else{
|
|
|
goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("客服二维码"));
|
|
|
}
|
|
|
+ List<Material> t6 = f.getT6();
|
|
|
+ if (Objects.nonNull(t6) &&!t6.isEmpty()) {
|
|
|
+ Optional.ofNullable(t6.get(RandomUtil.randomInt(0,t6.size()))).ifPresent(material -> goRequest.getItem().stream()
|
|
|
+ .filter(ff -> "title".equals(ff.getT()) && ff.getIsRandom())
|
|
|
+ .findFirst()
|
|
|
+ .ifPresent(item -> {item.setV(material.content());}));
|
|
|
+ }
|
|
|
Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
if (goRequest.getIsRandom()) {
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
@@ -568,7 +597,7 @@ public class GoGenerateService {
|
|
|
BeanUtil.copyProperties(jsonObject,goRequest);
|
|
|
Mono<List<StringBuilder>> stringBuilderMono = getStringBuilderMono(goRequest);
|
|
|
Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
|
|
|
- getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()),posterRequset)
|
|
|
+ getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1(),getTextListsTitle()),posterRequset)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
|
|
|
.onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
.flatMap(f -> template.update(f));
|