|
|
@@ -49,22 +49,13 @@ public class GoGenerateService {
|
|
|
private R2dbcEntityTemplate template;
|
|
|
|
|
|
//http://wx-share-test.duiweize.com
|
|
|
- ///api/image/createImage
|
|
|
-
|
|
|
//http://wx-share-8.duiweize.com 正式
|
|
|
public String goGenerate(String temStr){
|
|
|
-// JSONObject jsonObject = JSONUtil.parseObj(temStr);
|
|
|
-// GoRequest goRequest = new GoRequest();
|
|
|
-// BeanUtil.copyProperties(jsonObject,goRequest);
|
|
|
-// JSONObject jsonObject1 = JSONUtil.parseObj(goRequest);
|
|
|
String body="";
|
|
|
try {
|
|
|
- //JSONObject jsonObject = JSONUtil.parseObj(temStr);
|
|
|
body = HttpUtil.post(value + "/api/image/createImage",temStr,100000);
|
|
|
- // JSONUtil.parseObj(body);
|
|
|
return body;
|
|
|
} catch (Exception e) {
|
|
|
- // System.out.println(e);
|
|
|
throw new BaseException(e.getMessage()+"body:::"+body+":::request:::"+temStr);
|
|
|
}
|
|
|
|
|
|
@@ -72,12 +63,10 @@ public class GoGenerateService {
|
|
|
public String goGenerateStr(String temStr){
|
|
|
String body="";
|
|
|
try {
|
|
|
- //JSONObject jsonObject = JSONUtil.parseObj(temStr);
|
|
|
body = HttpUtil.post(value + "/api/image/createImage",temStr,100000);
|
|
|
JSONUtil.parseObj(body);
|
|
|
return body;
|
|
|
} catch (Exception e) {
|
|
|
- // System.out.println(e);
|
|
|
throw new BaseException(e.getMessage() + "body:::" +body);
|
|
|
}
|
|
|
|
|
|
@@ -85,9 +74,7 @@ public class GoGenerateService {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public Mono<RStatus<Poster>> savePoster(PosterRequest posterRequset){
|
|
|
-
|
|
|
String posterTemplate = posterRequset.getPosterTemplate();
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
GoRequest goRequest = new GoRequest();
|
|
|
@@ -99,20 +86,6 @@ public class GoGenerateService {
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
|
|
|
.onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
.flatMap(f -> template.insert(f));
|
|
|
-// if (goRequest.getIsRandom()) {
|
|
|
-// posterMono1 = getPosterResMono1(Mono.just(posterRequset),
|
|
|
-// getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()))
|
|
|
-// .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
|
|
|
-// .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
-// .flatMap(f -> template.insert(f));
|
|
|
-// }else {
|
|
|
-// posterMono1 = getPosterResMono1(Mono.just(posterRequset),
|
|
|
-// stringBuilderMono.flatMap(f -> Mono.just(goGenerateStr(JSONUtil.toJsonStr(goRequest)))))
|
|
|
-// .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
|
|
|
-// .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
-// .flatMap(f -> template.insert(f));
|
|
|
-// // return RStatus.success(posterMono1);
|
|
|
-// }
|
|
|
return RStatus.success(posterMono1);
|
|
|
}
|
|
|
|
|
|
@@ -195,9 +168,9 @@ public class GoGenerateService {
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
//封面
|
|
|
- if( Objects.nonNull(f.getT3()) &&!f.getT3().isEmpty()){
|
|
|
- goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst()
|
|
|
- .ifPresent(item -> item.setV(f.getT5().get(RandomUtil.randomInt(0, f.getT5().size())).image()));
|
|
|
+ if( Objects.nonNull(f.getT5()) &&!f.getT5().isEmpty()){
|
|
|
+ Optional<Item> first1 = goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst();
|
|
|
+ first1.ifPresent(item -> item.setV(f.getT5().get(RandomUtil.randomInt(0, f.getT5().size())).image()));
|
|
|
}
|
|
|
//图片
|
|
|
if( Objects.nonNull(f.getT2()) &&!f.getT2().isEmpty()){
|
|
|
@@ -214,7 +187,6 @@ public class GoGenerateService {
|
|
|
.ifPresent(item -> {item.setV(material.content());}));
|
|
|
}
|
|
|
String s1 = JSONUtil.toJsonStr(goRequest);
|
|
|
- // String s = goGenerateStr(s1);
|
|
|
return Mono.just(s1);
|
|
|
});
|
|
|
return stringMono;
|
|
|
@@ -254,19 +226,15 @@ public class GoGenerateService {
|
|
|
}
|
|
|
if (Objects.nonNull(f.getT4()) && !f.getT4().isEmpty()) {
|
|
|
Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
- //first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
if (goRequest.getIsRandom()) {
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//封面
|
|
|
if( Objects.nonNull(f.getT5()) &&!f.getT5().isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst()
|
|
|
.ifPresent(item -> item.setV(f.getT5().get(RandomUtil.randomInt(0, f.getT5().size())).image()));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
Optional<Item> first5 = goRequest.getItem().stream().filter(f1 -> "qrcode".equals(f1.getT())).findFirst();
|
|
|
if (first5.isPresent()) {
|
|
|
Item item = first5.get();
|
|
|
@@ -415,12 +383,10 @@ public class GoGenerateService {
|
|
|
}else{
|
|
|
goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("客服二维码"));
|
|
|
}
|
|
|
-
|
|
|
Optional<Image> first = f.getT1().stream().findFirst();
|
|
|
if (goRequest.getIsRandom()) {
|
|
|
first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
|
|
|
}
|
|
|
-
|
|
|
//封面
|
|
|
if (Objects.nonNull(f.getT5()) &&!f.getT5().isEmpty()) {
|
|
|
goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst()
|