|
|
@@ -71,6 +71,19 @@ public class PlanNewOutController {
|
|
|
map.clear();
|
|
|
log.info("清空计划-H5用户Map数据》》》》》》》》》》》》》》》》》》》》》》 结束");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取二维码缓存信息
|
|
|
+ * @param id
|
|
|
+ * @return {@link Mono}<{@link RStatus}<{@link QrcodeInfo}>>
|
|
|
+ */
|
|
|
+ @GetMapping("getQrcode/{id}")
|
|
|
+ public Mono<RStatus<QrcodeInfo>> getQrcode(@PathVariable("id") Long id){
|
|
|
+ Mono<QrcodeInfo> qrcodeInfoMono = template.selectOne(Query.query(Criteria.where("id").is(id)), QrcodeInfo.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("id异常 查询结果为空")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException("查询异常::::" + throwable.getMessage())));
|
|
|
+ return RStatus.success(qrcodeInfoMono);
|
|
|
+ }
|
|
|
/**
|
|
|
*通过 code and type 查询 domain
|
|
|
* @param code
|
|
|
@@ -632,38 +645,61 @@ public class PlanNewOutController {
|
|
|
Optional<Item> first1 = goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) && ff.getIsRandom()).findFirst();
|
|
|
first1.ifPresent(item -> fm.setGroupHeadUrl(item.getV()));
|
|
|
}
|
|
|
- String ret;
|
|
|
- if (Objects.nonNull(goRequest)) {
|
|
|
- ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
- } else {
|
|
|
-
|
|
|
- ret = goGenerateService.goGenerate(posterTemplate);
|
|
|
+ if (Objects.isNull(goRequest)) {
|
|
|
+ throw new BaseException("isNull(goRequest) setEndData()");
|
|
|
+ }
|
|
|
+ QrcodeInfo stringBuilder = getQrcodeInfo(goRequest);
|
|
|
+ Mono<QrcodeInfo> qrcodeInfoMono ;
|
|
|
+ if(Objects.nonNull(fm.getPlanNew().groupListDisplay()) && fm.getPlanNew().groupListDisplay()==1){
|
|
|
+ qrcodeInfoMono = template.insert(stringBuilder)
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException("插入QrcodeInfo异常::::" + throwable.getMessage())));
|
|
|
+ }else {
|
|
|
+ qrcodeInfoMono = Mono.just(stringBuilder);
|
|
|
}
|
|
|
- if (Objects.nonNull(ret)) {
|
|
|
- JSONObject jsonObject1;
|
|
|
- try {
|
|
|
- jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
- }catch (Exception e){
|
|
|
- throw new BaseException(e.getMessage() +"---"+JSONUtil.parseObj(goRequest));
|
|
|
+ return Mono.zip(qrcodeInfoMono,Mono.just(goRequest),Mono.just(fm)).flatMap(f9->{
|
|
|
+ GoRequest goRequest2 = f9.getT2();
|
|
|
+ if (Objects.nonNull(f9.getT1().id())) {
|
|
|
+ goRequest2.getItem().stream().filter(f1 -> "qrcode".equals(f1.getT())).forEach(fe->{
|
|
|
+ if (Objects.nonNull(fe.getV())) {
|
|
|
+ String qrcode = fe.getV() + "&id=" + f9.getT1().id();
|
|
|
+ fe.setV(qrcode);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- 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()) && !"".equals(request.getWx_user_id())) {
|
|
|
- fm.setQsGenerateImagesUrl(url);
|
|
|
- } else {
|
|
|
- fm.setFxGenerateImagesUrl(url);
|
|
|
+ DataLists0 fm3 = f9.getT3();
|
|
|
+ String ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest2));
|
|
|
+ if (Objects.nonNull(ret)) {
|
|
|
+ JSONObject jsonObject1;
|
|
|
+ try {
|
|
|
+ jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new BaseException(e.getMessage() +"---"+JSONUtil.parseObj(goRequest2));
|
|
|
+ }
|
|
|
+ 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()) && !"".equals(request.getWx_user_id())) {
|
|
|
+ fm3.setQsGenerateImagesUrl(url);
|
|
|
+ } else {
|
|
|
+ fm3.setFxGenerateImagesUrl(url);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- return Mono.just(fm);
|
|
|
+ return Mono.just(fm3);
|
|
|
+ });
|
|
|
});
|
|
|
return dataLists0Mono1;
|
|
|
}
|
|
|
-
|
|
|
+ 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;
|
|
|
+ }
|
|
|
// 设置封面等
|
|
|
private Mono<DataLists0> setFmV(HftRequest request, Mono<DataLists0> zip) {
|
|
|
Mono<DataLists0> dataLists0Mono2 = zip.flatMap(fm -> {
|