Przeglądaj źródła

听书裂变3.11

MOKASZ\lw12420 2 lat temu
rodzic
commit
acbe3cfed9

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

@@ -308,7 +308,7 @@ public class PlanNewController {
         Criteria empty = Criteria.where("poster_template_id").is(posterTemplateRequset.getPosterTemplateId());
         Update update = Update.update("updated_at", ZonedDateTime.now());
         if(Objects.nonNull(posterTemplateRequset.getPosterTemplateName()) && !"".equals(posterTemplateRequset.getPosterTemplateName())){
-            update.set("poster_template_name",posterTemplateRequset.getPosterTemplateName());
+            update=  update.set("poster_template_name",posterTemplateRequset.getPosterTemplateName());
         }
         Mono<Long> update1 = template.update(Query.query(empty), update, PosterTemplate.class);
         return  RStatus.success(update1);

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

@@ -10,6 +10,7 @@ import com.webflux.launchadmin.config.BaseContextHandler;
 import com.webflux.launchadmin.global.BaseException;
 import com.webflux.launchadmin.mysql.controller.planNew.req.*;
 import com.webflux.launchadmin.mysql.controller.planNew.res.*;
+import com.webflux.launchadmin.mysql.entity.listening.ListeningPlanNew;
 import com.webflux.launchadmin.mysql.entity.planNew.*;
 import com.webflux.launchadmin.mysql.service.planNew.goGenerate.GoGenerateService;
 import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
@@ -66,24 +67,43 @@ public class PlanNewOutController {
      * @return {@link Mono}<{@link RStatus}<{@link DomainSelectRes}>>
      */
     @GetMapping("domain/select")
-    public Mono<RStatus<DomainSelectRes>> domainSelect(@RequestParam("code") String code,@RequestParam("type") String type ){
-        Mono<PlanNew> code1 = template.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
-                .switchIfEmpty(Mono.error(new BaseException("code错误")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
-        Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria.where("group_type_id").is(f.groupId())
-                .and("status").is(1).and("type").is(type)), DomainSelect.class)
-                .switchIfEmpty(Mono.error(new BaseException("查询domain为空")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fm -> {
-                    DomainSelectRes domainSelectRes = new DomainSelectRes();
-                    int i = RandomUtil.randomInt(0, fm.size());
-                    String domain = fm.get(i).domain();
-                    String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
-                    domainSelectRes.setDomain(string+"."+domain);
-                    domainSelectRes.setPath("");
-                    domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
-                    return Mono.just(domainSelectRes);
-                }));
-        return RStatus.success(domainSelectResMono1);
+
+    public Mono<RStatus<DomainSelectRes>> domainSelect(@RequestParam("code") String code,@RequestParam("type") String type ,@RequestParam("typePlan") Integer typePlan ){
+        if (1 == typePlan) {
+            Mono<PlanNew> code1 = template.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class);
+            Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria.where("group_type_id").is(f.groupId())
+                    .and("status").is(1).and("type").is(type)), DomainSelect.class)
+                    .switchIfEmpty(Mono.error(new BaseException("查询domain为空")))
+                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fm -> {
+                        DomainSelectRes domainSelectRes = new DomainSelectRes();
+                        int i = RandomUtil.randomInt(0, fm.size());
+                        String domain = fm.get(i).domain();
+                        String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
+                        domainSelectRes.setDomain(string+"."+domain);
+                        domainSelectRes.setPath("");
+                        domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
+                        return Mono.just(domainSelectRes);
+                    }));
+            return RStatus.success(domainSelectResMono1);
+        }else  if(2==typePlan){
+            Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code").is(code)), ListeningPlanNew.class);
+            Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria.where("group_type_id").is(f.groupId())
+                    .and("status").is(1).and("type").is(type)), DomainSelect.class)
+                    .switchIfEmpty(Mono.error(new BaseException("查询domain为空")))
+                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fm -> {
+                        DomainSelectRes domainSelectRes = new DomainSelectRes();
+                        int i = RandomUtil.randomInt(0, fm.size());
+                        String domain = fm.get(i).domain();
+                        String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
+                        domainSelectRes.setDomain(string+"."+domain);
+                        domainSelectRes.setPath("");
+                        domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
+                        return Mono.just(domainSelectRes);
+                    }));
+            return RStatus.success(domainSelectResMono1);
+        }
+        throw new BaseException("typePlan 类型错误");
+        
     }
     /**
      * 列表返回images(列表内容),shareQrurl(背景组) ,baiduDot,retAudio