|
|
@@ -708,7 +708,12 @@ public class PlanNewCommonOutController {
|
|
|
// Mono<byte[]> res = resMono1.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
return RStatus.successList(resMono1);
|
|
|
}
|
|
|
-
|
|
|
+ private QrcodeInfo getQrcodeInfo(GoRequest goRequest) {
|
|
|
+ Optional<Item> first = goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) ).findFirst();
|
|
|
+ Optional<Item> first3 = goRequest.getItem().stream().filter(ff -> "title".equals(ff.getT())).findFirst();
|
|
|
+ QrcodeInfo qrcodeInfo = new QrcodeInfo(null,first.isPresent()?first.get().getV():"",first3.isPresent()?first3.get().getV():"");
|
|
|
+ return qrcodeInfo;
|
|
|
+ }
|
|
|
/**
|
|
|
* 设置二维码 生成图片
|
|
|
*/
|
|
|
@@ -728,34 +733,60 @@ public class PlanNewCommonOutController {
|
|
|
PlanNewBackgroupPoster fxSetting = fm.getFxSetting();
|
|
|
goRequest = setNameVal(posterTemplate, fxSetting, fm.getSpare());
|
|
|
}
|
|
|
- String ret;
|
|
|
- if (Objects.nonNull(goRequest)) {
|
|
|
- ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
- } else {
|
|
|
-
|
|
|
- ret = goGenerateService.goGenerate(posterTemplate);
|
|
|
+ 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())));
|
|
|
}
|
|
|
- if (Objects.nonNull(ret)) {
|
|
|
- JSONObject jsonObject1;
|
|
|
- try {
|
|
|
- jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
- } catch (Exception e) {
|
|
|
- return Mono.error(new BaseException(e.getMessage() + "---" + JSONUtil.parseObj(goRequest) + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString()));
|
|
|
- }
|
|
|
- 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()) {
|
|
|
- fm.setQsGenerateImagesUrl(url);
|
|
|
- } else {
|
|
|
- fm.setFxGenerateImagesUrl(url);
|
|
|
+
|
|
|
+ return Mono.zip(Mono.just(fm),qrcodeInfoMono).flatMap(fm1->{
|
|
|
+ if (Objects.nonNull(fm1.getT2().id())) {
|
|
|
+ goRequest.getItem()
|
|
|
+ .stream()
|
|
|
+ .filter(filter -> "cusqrcode".equals(filter.getT())
|
|
|
+ && filter.getIsRandom()
|
|
|
+ && 1 == filter.getType()).collect(Collectors.toList()).forEach(fe -> {
|
|
|
+ if (Objects.nonNull(fe.getV())) {
|
|
|
+ if (fe.getV().contains("?")){
|
|
|
+ String cusqrcode = fe.getV() + "&id=" + fm1.getT2().id();
|
|
|
+ fe.setV(cusqrcode);
|
|
|
+ }else{
|
|
|
+ String cusqrcode = fe.getV() + "?id=" + fm1.getT2().id();
|
|
|
+ fe.setV(cusqrcode);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|