Ver Fonte

plan-java v0.44

(cherry picked from commit 1aa5da1eed7c054191a03e3f8ab5b05bcd388246)
MOKASZ\lw12420 há 2 anos atrás
pai
commit
4d3b94ba81

+ 2 - 1
launch-admin/src/main/java/com/webflux/launchadmin/mysql/controller/planNew/PlanNewOutController.java

@@ -245,8 +245,9 @@ public class PlanNewOutController {
         Mono<List<Poster>> Poster = code.flatMap(plan -> template.select(Query.query(Criteria.where("poster_template_id")
                 .is(plan.posterTemplateId())).sort(Sort.by(Sort.Order.desc("created_at"))), Poster.class).collectList());
         Mono<List<PlanNewBackgroupPoster>> planNewBackgroupPoster = code.flatMap(plan -> template.select(Query.query(Criteria.where("plan_new_id")
-                .is(plan.planNewId())).sort(Sort.by(Sort.Order.desc("idx"))), PlanNewBackgroupPoster.class)
+                .is(plan.planNewId())).sort(Sort.by(Sort.Order.asc("idx"))), PlanNewBackgroupPoster.class)
                 .collectList());
+
         Mono<DataLists0> dataLists0Mono = Mono.zip(code, poster_template, Poster, planNewBackgroupPoster,stringBuilderMono).flatMap(f -> {
             DataLists0 dataLists0 = new DataLists0();
             dataLists0.setSpare(f.getT5().toString());

+ 51 - 33
launch-admin/src/main/java/com/webflux/launchadmin/mysql/service/planNew/goGenerate/GoGenerateService.java

@@ -62,18 +62,22 @@ public class GoGenerateService {
 
     }
     public String goGenerateStr(String temStr){
+        String body="";
         try {
-            JSONObject jsonObject = JSONUtil.parseObj(temStr);
-            String body = HttpUtil.post(value + "/api/image/createImage",temStr,100000);
+            //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());
+            throw new BaseException(e.getMessage() + "body:::" +body);
         }
 
 
 
     }
+
+   
     public Mono<RStatus<Poster>> savePoster(PosterRequest posterRequset){
 
         String posterTemplate = posterRequset.getPosterTemplate();
@@ -81,21 +85,26 @@ public class GoGenerateService {
         GoRequest goRequest = new GoRequest();
         BeanUtil.copyProperties(jsonObject,goRequest);//cusqrcode
         Mono<List<StringBuilder>> stringBuilderMono = getStringBuilderMono(goRequest);
-        Mono<Poster> posterMono1 ;
-        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);
-        }
+
+        Mono<Poster> 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));
+//        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);
     }
 
@@ -111,6 +120,7 @@ public class GoGenerateService {
         return template.select(Query.query(Criteria.where("type").is(14)), Material.class).collectList();
     }
 
+    //背景
     private Mono<List<Image>> getBgImage() {
         return template.select(Query.query(Criteria.where("type").is(2)), Image.class).collectList();
     }
@@ -328,6 +338,7 @@ public class GoGenerateService {
             if (goRequest.getIsRandom()) {
                 first.ifPresent(image -> goRequest.setBg_img_src(image.image()));
             }
+            goRequest.getItem().stream().filter(fc->"cusqrcode".equals(fc.getT())).forEach(fe->fe.setName("H5二维码"));
             //封面
             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()));
@@ -341,6 +352,7 @@ public class GoGenerateService {
                     .filter(ff -> "text".equals(ff.getT()) && ff.getIsRandom())
                     .findFirst()
                     .ifPresent(item -> item.setV(material.content())));
+
             String s1 = JSONUtil.toJsonStr(goRequest);
             String s = goGenerateStr(s1);
             return Mono.just(s);
@@ -506,21 +518,27 @@ public class GoGenerateService {
         GoRequest goRequest = new GoRequest();
         BeanUtil.copyProperties(jsonObject,goRequest);
         Mono<List<StringBuilder>> stringBuilderMono = getStringBuilderMono(goRequest);
-        if (goRequest.getIsRandom()) {
-            Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
-                    getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()),posterRequset)
-                    .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
-                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
-                    .flatMap(f -> template.update(f));
-            return RStatus.success(posterMono1);
-        }else {
-            Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
-                    stringBuilderMono.flatMap(f -> Mono.just(goGenerateStr(JSONUtil.toJsonStr(goRequest)))),posterRequset)
-                    .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
-                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
-                    .flatMap(f -> template.update(f));
-            return RStatus.success(posterMono1);
-        }
+        Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
+                getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()),posterRequset)
+                .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
+                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                .flatMap(f -> template.update(f));
+        return RStatus.success(posterMono1);
+//        if (goRequest.getIsRandom()) {
+//            Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
+//                    getStringMono(goRequest, stringBuilderMono, getBgImage(), getFmImageLists0(), getTextLists(),getImageType1()),posterRequset)
+//                    .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
+//                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+//                    .flatMap(f -> template.update(f));
+//            return RStatus.success(posterMono1);
+//        }else {
+//            Mono<Poster> posterMono1 = getPosterResMonoUpdate(Mono.just(posterRequset),
+//                    stringBuilderMono.flatMap(f -> Mono.just(goGenerateStr(JSONUtil.toJsonStr(goRequest)))),posterRequset)
+//                    .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
+//                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+//                    .flatMap(f -> template.update(f));
+//            return RStatus.success(posterMono1);
+//        }
 
     }