|
|
@@ -95,10 +95,14 @@ public class GoGenerateService {
|
|
|
if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdSc())) {
|
|
|
imageGroupId2=firstImage2.get().getGroupTypeIdSc();
|
|
|
}
|
|
|
+ Long imageGroupIdBj=0L;
|
|
|
+ if(goRequest.getIsRandom()){
|
|
|
+ imageGroupIdBj=goRequest.getGroupTypeIdSc();
|
|
|
+ }
|
|
|
Mono<Poster> posterMono1 = getPosterResMono1(Mono.just(posterRequset),
|
|
|
getStringMono(goRequest,
|
|
|
stringBuilderMono,
|
|
|
- getBgImage(),
|
|
|
+ getBgImage(imageGroupIdBj),
|
|
|
getImageSaveOrUpdatePoster(imageGroupId),
|
|
|
getTextListsPoster(imageGroupId1),
|
|
|
getImageType1Poster(imageGroupId2),
|
|
|
@@ -193,8 +197,8 @@ public class GoGenerateService {
|
|
|
}
|
|
|
|
|
|
//背景
|
|
|
- private Mono<List<Image>> getBgImage() {
|
|
|
- return template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Image.class)
|
|
|
+ private Mono<List<Image>> getBgImage(Long id) {
|
|
|
+ return template.select(Query.query(Criteria.where("type").is(2).and("group_type_id").is(id).and("deleted_at").isNull()), Image.class)
|
|
|
.collectList();
|
|
|
}
|
|
|
|
|
|
@@ -228,9 +232,13 @@ public class GoGenerateService {
|
|
|
if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdSc())) {
|
|
|
imageGroupId2=firstImage2.get().getGroupTypeIdSc();
|
|
|
}
|
|
|
+ Long imageGroupIdBj=0L;
|
|
|
+ if(goRequest.getIsRandom()){
|
|
|
+ imageGroupIdBj=goRequest.getGroupTypeIdSc();
|
|
|
+ }
|
|
|
return getStringMonoOut(goRequest,
|
|
|
stringBuilderMono,
|
|
|
- getBgImageYx(),
|
|
|
+ getBgImageYx(imageGroupIdBj),
|
|
|
getFmImageListsYx(imageGroupId),
|
|
|
getTextListsYx(imageGroupId1),
|
|
|
getImageTypeYx(imageGroupId2),
|
|
|
@@ -247,29 +255,36 @@ public class GoGenerateService {
|
|
|
// }
|
|
|
Optional<Item> firstImage = goRequest.getItem().stream().filter(ft -> "image".equals(ft.getT())).findFirst();
|
|
|
Long imageGroupId=0L;
|
|
|
- if (firstImage.isPresent() && Objects.nonNull(firstImage.get().getGroupTypeIdSc())) {
|
|
|
- imageGroupId=firstImage.get().getGroupTypeIdSc();
|
|
|
+ if (firstImage.isPresent() && Objects.nonNull(firstImage.get().getGroupTypeIdQs())) {
|
|
|
+ imageGroupId=firstImage.get().getGroupTypeIdQs();
|
|
|
}
|
|
|
Optional<Item> firstImage1 = goRequest.getItem().stream().filter(ft -> "text".equals(ft.getT())).findFirst();
|
|
|
Long imageGroupId1=0L;
|
|
|
- if (firstImage1.isPresent() && Objects.nonNull(firstImage1.get().getGroupTypeIdSc())) {
|
|
|
- imageGroupId1=firstImage1.get().getGroupTypeIdSc();
|
|
|
+ if (firstImage1.isPresent() && Objects.nonNull(firstImage1.get().getGroupTypeIdQs())) {
|
|
|
+ imageGroupId1=firstImage1.get().getGroupTypeIdQs();
|
|
|
}
|
|
|
Optional<Item> firstImage2 = goRequest.getItem().stream().filter(ft -> "cover".equals(ft.getT())).findFirst();
|
|
|
Long imageGroupId2=0L;
|
|
|
- if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdSc())) {
|
|
|
- imageGroupId2=firstImage2.get().getGroupTypeIdSc();
|
|
|
+ if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdQs())) {
|
|
|
+ imageGroupId2=firstImage2.get().getGroupTypeIdQs();
|
|
|
+ }
|
|
|
+ Long imageGroupIdBj=0L;
|
|
|
+ if(goRequest.getIsRandom()){
|
|
|
+ imageGroupIdBj=goRequest.getGroupTypeIdQs();
|
|
|
}
|
|
|
return getStringMonoOut(goRequest,
|
|
|
stringBuilderMono,
|
|
|
- getBgImageQs(),
|
|
|
+ getBgImageQs(imageGroupIdBj),
|
|
|
getFmImageListsQs(imageGroupId),
|
|
|
getTextListsQs(imageGroupId1),
|
|
|
getImageTypeQs(imageGroupId2),
|
|
|
getTextListsTitleH5(goRequest));
|
|
|
}
|
|
|
- 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();
|
|
|
+ private Mono<List<Image>> getBgImageQs(Long id) {
|
|
|
+ return template.select(Query.query(Criteria.where("type").is(2)
|
|
|
+ .and("group_type").is(2)
|
|
|
+ .and("group_type_id").is(id)
|
|
|
+ .and("deleted_at").isNull()), Image.class).collectList();
|
|
|
}
|
|
|
|
|
|
private Mono<List<Image>> getFmImageListsQs(Long id) {
|
|
|
@@ -298,8 +313,10 @@ public class GoGenerateService {
|
|
|
.and("group_type_id").is(id)
|
|
|
.and("group_type").is(1).and("deleted_at").isNull()), Material.class).collectList();
|
|
|
}
|
|
|
- private Mono<List<Image>> getBgImageYx() {
|
|
|
- return template.select(Query.query(Criteria.where("type").is(2).and("group_type").is(1).and("deleted_at").isNull()), Image.class).collectList();
|
|
|
+ private Mono<List<Image>> getBgImageYx(Long id) {
|
|
|
+ return template.select(Query.query(Criteria.where("type").is(2)
|
|
|
+ .and("group_type").is(1).and("group_type_id").is(id)
|
|
|
+ .and("deleted_at").isNull()), Image.class).collectList();
|
|
|
}
|
|
|
private Mono<List<Image>> getFmImageListsYx(Long id) {
|
|
|
return template.select(Query.query(Criteria.where("type").is(10)
|
|
|
@@ -351,6 +368,9 @@ public class GoGenerateService {
|
|
|
}
|
|
|
Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
if (goRequest.getIsRandom()) {
|
|
|
+ if (first.isEmpty()) {
|
|
|
+ throw new BaseException("背景素材为空");
|
|
|
+ }
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
//封面
|
|
|
@@ -444,8 +464,12 @@ public class GoGenerateService {
|
|
|
if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdSc())) {
|
|
|
imageGroupId2=firstImage2.get().getGroupTypeIdSc();
|
|
|
}
|
|
|
+ Long imageGroupIdBj=0L;
|
|
|
+ if(goRequest.getIsRandom()){
|
|
|
+ imageGroupIdBj=goRequest.getGroupTypeIdSc();
|
|
|
+ }
|
|
|
return saveAndUpdatePlanGenerateImage1(goRequest, stringBuilderMono,
|
|
|
- getBgImage(),
|
|
|
+ getBgImage(imageGroupIdBj),
|
|
|
getImageSaveOrUpdatePlan(imageGroupId),
|
|
|
getTextListsPlan(imageGroupId1),
|
|
|
getImageType1Plan(imageGroupId2),
|
|
|
@@ -478,13 +502,16 @@ public class GoGenerateService {
|
|
|
if (first2.isPresent()) {
|
|
|
throw new BaseException("自定义二维码素材为空");
|
|
|
}
|
|
|
- if (Objects.nonNull(f.getT4()) && !f.getT4().isEmpty()) {
|
|
|
- Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
- if (goRequest.getIsRandom()) {
|
|
|
- first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
+// if (Objects.nonNull(f.getT4()) && !f.getT4().isEmpty()) {
|
|
|
+//
|
|
|
+// }
|
|
|
+ Optional<Image> first01 = f.getT1().stream().findFirst();
|
|
|
+ if (goRequest.getIsRandom()) {
|
|
|
+ if (first01.isEmpty()) {
|
|
|
+ throw new BaseException("背景素材为空");
|
|
|
}
|
|
|
+ first01.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
-
|
|
|
List<Material> t7 = f.getT7().stream().filter(ft->Objects.nonNull(ft.id())).collect(Collectors.toList());
|
|
|
if (Objects.nonNull(t7) &&!t7.isEmpty()) {
|
|
|
Optional.ofNullable(t7.get(RandomUtil.randomInt(0,t7.size()))).ifPresent(material -> goRequest.getItem().stream()
|
|
|
@@ -702,6 +729,9 @@ public class GoGenerateService {
|
|
|
}
|
|
|
Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
if (goRequest.getIsRandom()) {
|
|
|
+ if (first.isEmpty()) {
|
|
|
+ throw new BaseException("背景素材为空");
|
|
|
+ }
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
//封面
|
|
|
@@ -920,8 +950,14 @@ public class GoGenerateService {
|
|
|
if (firstImage2.isPresent() && Objects.nonNull(firstImage2.get().getGroupTypeIdSc())) {
|
|
|
imageGroupId2=firstImage2.get().getGroupTypeIdSc();
|
|
|
}
|
|
|
+ Long imageGroupIdBj=0L;
|
|
|
+ if(goRequest.getIsRandom()){
|
|
|
+ imageGroupIdBj=goRequest.getGroupTypeIdSc();
|
|
|
+ }
|
|
|
Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
|
|
|
- getStringMono(goRequest, stringBuilderMono, getBgImage(),
|
|
|
+ getStringMono(goRequest,
|
|
|
+ stringBuilderMono,
|
|
|
+ getBgImage(imageGroupIdBj),
|
|
|
getImageSaveOrUpdatePoster(imageGroupId),
|
|
|
getTextListsPoster(imageGroupId1),
|
|
|
getImageType1Poster(imageGroupId2),
|