|
|
@@ -83,27 +83,80 @@ public class PlanNewOutController {
|
|
|
.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
|
|
|
.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.landingPageDomain())
|
|
|
- .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.setBackgroupDomain(f.backgroupDomain());
|
|
|
- domainSelectRes.setTransferPageDomain(f.transferPageDomain());
|
|
|
- domainSelectRes.setTransferPageBl(f.transferPageBl());
|
|
|
- domainSelectRes.setDomain(string+"."+domain);
|
|
|
- domainSelectRes.setPath("");
|
|
|
- domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
- return Mono.just(domainSelectRes);
|
|
|
- }));
|
|
|
+ Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> {
|
|
|
+ Mono<String> stringMono;
|
|
|
+ if (f.transferPageBl() == 1 && Objects.nonNull(f.transferPageDomain())) {
|
|
|
+ stringMono = template.select(Query.query(Criteria
|
|
|
+ .where("group_type_id").is(f.transferPageDomain())
|
|
|
+ .and("status").is(1)
|
|
|
+ .and("type").is(5)
|
|
|
+ .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.transferPageDomain())))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ if (!fff.isEmpty()) {
|
|
|
+ DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
+ String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
+ String domain1 = domainSelect.domain();
|
|
|
+ return Mono.just(string+"."+domain1);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.transferPageDomain());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ stringMono = Mono.just(" ");
|
|
|
+ }
|
|
|
+ Mono<String> stringMono1;
|
|
|
+ if ( Objects.nonNull(f.backgroupDomain()) && !"".equals(f.backgroupDomain().trim()) ) {
|
|
|
+ stringMono1 = template.select(Query.query(Criteria
|
|
|
+ .where("group_type_id").is(f.backgroupDomain())
|
|
|
+ .and("status").is(1)
|
|
|
+ .and("type").is(4)
|
|
|
+ .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查詢為空 group_type_id" + f.backgroupDomain())))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ if (!fff.isEmpty()) {
|
|
|
+ DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
+ String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
+ String domain1 = domainSelect.domain();
|
|
|
+ return Mono.just(string+"."+domain1);
|
|
|
+ } else {
|
|
|
+ throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.backgroupDomain());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ stringMono1 = Mono.just(" ");
|
|
|
+ }
|
|
|
+ Mono<String> stringMono2 = template.select(Query.query(Criteria.where("group_type_id").is(f.landingPageDomain())
|
|
|
+ .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.setBackgroupDomain(f.backgroupDomain());
|
|
|
+ domainSelectRes.setTransferPageDomain(f.transferPageDomain());
|
|
|
+ domainSelectRes.setTransferPageBl(f.transferPageBl());
|
|
|
+ domainSelectRes.setDomain(string + "." + domain);
|
|
|
+ domainSelectRes.setPath("");
|
|
|
+ domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
+ return Mono.just(string + "." + domain);
|
|
|
+ });
|
|
|
+ return Mono.zip(stringMono2,stringMono1,stringMono).flatMap(fff->{
|
|
|
+ DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
+ domainSelectRes.setDomain(fff.getT1());
|
|
|
+ domainSelectRes.setTransferPageBl(f.transferPageBl());
|
|
|
+ domainSelectRes.setBackgroupDomain(fff.getT2());
|
|
|
+ domainSelectRes.setTransferPageDomain(fff.getT3());
|
|
|
+ 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)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception( throwable.getMessage())));;
|
|
|
+ .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 返回结果为空")))
|
|
|
@@ -344,56 +397,57 @@ public class PlanNewOutController {
|
|
|
List<Ad> ads = f.getT7().subList(0, f.getT1().bottomAdvNum());
|
|
|
dataLists.setBottomAd(ads);
|
|
|
}
|
|
|
- Mono<String> stringMono;
|
|
|
- if (f.getT1().transferPageBl() == 1 && Objects.nonNull(f.getT1().transferPageDomain())) {
|
|
|
- stringMono = template.select(Query.query(Criteria
|
|
|
- .where("group_type_id").is(f.getT1().transferPageDomain())
|
|
|
- .and("status").is(1)
|
|
|
- .and("type").is(5)
|
|
|
- .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
- .switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
- if (!fff.isEmpty()) {
|
|
|
- DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
- String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
- String domain1 = domainSelect.domain();
|
|
|
- return Mono.just(string+"."+domain1);
|
|
|
-
|
|
|
- } else {
|
|
|
- throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain());
|
|
|
- }
|
|
|
- });
|
|
|
- }else {
|
|
|
- stringMono = Mono.just(" ");
|
|
|
- }
|
|
|
- Mono<String> stringMono1;
|
|
|
- if ( Objects.nonNull(f.getT1().backgroupDomain()) && !"".equals(f.getT1().backgroupDomain().trim()) ) {
|
|
|
- stringMono1 = template.select(Query.query(Criteria
|
|
|
- .where("group_type_id").is(f.getT1().backgroupDomain())
|
|
|
- .and("status").is(1)
|
|
|
- .and("type").is(4)
|
|
|
- .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
- .switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查詢為空 group_type_id" + f.getT1().backgroupDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
- if (!fff.isEmpty()) {
|
|
|
- DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
- String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
- String domain1 = domainSelect.domain();
|
|
|
- return Mono.just(string+"."+domain1);
|
|
|
- } else {
|
|
|
- throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.getT1().backgroupDomain());
|
|
|
- }
|
|
|
- });
|
|
|
- }else {
|
|
|
- stringMono1 = Mono.just(" ");
|
|
|
- }
|
|
|
- return Mono.zip(stringMono,stringMono1,Mono.just(dataLists)).flatMap(fff->{
|
|
|
- DataLists t3 = fff.getT3();
|
|
|
- t3.setTransferPageBl(f.getT1().transferPageBl());
|
|
|
- t3.setTransferPageDomain(fff.getT1());
|
|
|
- t3.setBackgroupDomain(fff.getT2());
|
|
|
- return Mono.just(t3);
|
|
|
- });
|
|
|
+// Mono<String> stringMono;
|
|
|
+// if (f.getT1().transferPageBl() == 1 && Objects.nonNull(f.getT1().transferPageDomain())) {
|
|
|
+// stringMono = template.select(Query.query(Criteria
|
|
|
+// .where("group_type_id").is(f.getT1().transferPageDomain())
|
|
|
+// .and("status").is(1)
|
|
|
+// .and("type").is(5)
|
|
|
+// .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
+// .switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain())))
|
|
|
+// .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+// if (!fff.isEmpty()) {
|
|
|
+// DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
+// String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
+// String domain1 = domainSelect.domain();
|
|
|
+// return Mono.just(string+"."+domain1);
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.getT1().transferPageDomain());
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }else {
|
|
|
+// stringMono = Mono.just(" ");
|
|
|
+// }
|
|
|
+// Mono<String> stringMono1;
|
|
|
+// if ( Objects.nonNull(f.getT1().backgroupDomain()) && !"".equals(f.getT1().backgroupDomain().trim()) ) {
|
|
|
+// stringMono1 = template.select(Query.query(Criteria
|
|
|
+// .where("group_type_id").is(f.getT1().backgroupDomain())
|
|
|
+// .and("status").is(1)
|
|
|
+// .and("type").is(4)
|
|
|
+// .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
+// .switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查詢為空 group_type_id" + f.getT1().backgroupDomain())))
|
|
|
+// .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+// if (!fff.isEmpty()) {
|
|
|
+// DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
+// String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
+// String domain1 = domainSelect.domain();
|
|
|
+// return Mono.just(string+"."+domain1);
|
|
|
+// } else {
|
|
|
+// throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.getT1().backgroupDomain());
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }else {
|
|
|
+// stringMono1 = Mono.just(" ");
|
|
|
+// }
|
|
|
+// return Mono.zip(stringMono,stringMono1,Mono.just(dataLists)).flatMap(fff->{
|
|
|
+// DataLists t3 = fff.getT3();
|
|
|
+// t3.setTransferPageBl(f.getT1().transferPageBl());
|
|
|
+// t3.setTransferPageDomain(fff.getT1());
|
|
|
+// t3.setBackgroupDomain(fff.getT2());
|
|
|
+// return Mono.just(t3);
|
|
|
+// });
|
|
|
+ return Mono.just(dataLists);
|
|
|
});
|
|
|
return dataListsMono;
|
|
|
});
|