|
@@ -22,6 +22,7 @@ import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
|
import com.webflux.launchadmin.mysql.service.takeaway.TakeawayServicesInterface;
|
|
import com.webflux.launchadmin.mysql.service.takeaway.TakeawayServicesInterface;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
|
|
+import com.webflux.launchcommon.utils.StringUtils;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.json.Json;
|
|
import jakarta.json.Json;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -268,11 +269,13 @@ public class PlanNewCommonOutController {
|
|
|
} else if (2 == request.getTypePlan()) {
|
|
} else if (2 == request.getTypePlan()) {
|
|
|
// 听书裂变
|
|
// 听书裂变
|
|
|
return this.getListeningPlan(request);
|
|
return this.getListeningPlan(request);
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if(3==request.getTypePlan()){
|
|
|
// 交友裂变
|
|
// 交友裂变
|
|
|
return this.getFriendPlan(request);
|
|
return this.getFriendPlan(request);
|
|
|
|
|
+ }else if(4==request.getTypePlan()){
|
|
|
|
|
+ return this.getTakeaway(request);
|
|
|
}
|
|
}
|
|
|
- // throw new BaseException("typePlan 类型错误");
|
|
|
|
|
|
|
+ throw new BaseException("typePlan 类型错误");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -403,6 +406,78 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.just(string + "." + domain);
|
|
return Mono.just(string + "." + domain);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ Mono<String> transferPageDomain;
|
|
|
|
|
+ if ( Objects.nonNull(request.getTransferPageDomain()) && StringUtils.isNotEmpty(request.getTransferPageDomain())) {
|
|
|
|
|
+ transferPageDomain = template.select(Query.query(Criteria
|
|
|
|
|
+ .where("group_type_id").is(request.getTransferPageDomain())
|
|
|
|
|
+ .and("status").is(1)
|
|
|
|
|
+ .and("type").is(5)
|
|
|
|
|
+ .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + request.getTransferPageDomain())))
|
|
|
|
|
+ .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:::" + request.getTransferPageDomain());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ transferPageDomain = Mono.just(" ");
|
|
|
|
|
+ }
|
|
|
|
|
+ Mono<String> backgroupDomain;
|
|
|
|
|
+ if (Objects.nonNull(request.getBackgroupDomain()) && StringUtils.isNotEmpty(request.getBackgroupDomain())) {
|
|
|
|
|
+ backgroupDomain = template.select(Query.query(Criteria
|
|
|
|
|
+ .where("group_type_id").is(request.getBackgroupDomain())
|
|
|
|
|
+ .and("status").is(1)
|
|
|
|
|
+ .and("type").is(4)
|
|
|
|
|
+ .and("deleted_at").isNull()), DomainSelect.class)
|
|
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查询为空 group_type_id" + request.getBackgroupDomain())))
|
|
|
|
|
+ .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" + request.getBackgroupDomain());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ backgroupDomain = Mono.just(" ");
|
|
|
|
|
+ }
|
|
|
|
|
+ Mono<DomainSelectRes> res = Mono.zip(stringMono,transferPageDomain,backgroupDomain).flatMap(tuple3 -> {
|
|
|
|
|
+ DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
|
|
+ domainSelectRes.setDomain(tuple3.getT1());
|
|
|
|
|
+ domainSelectRes.setTransferPageDomain(tuple3.getT2());
|
|
|
|
|
+ domainSelectRes.setBackgroupDomain(tuple3.getT3());
|
|
|
|
|
+ domainSelectRes.setPath("");
|
|
|
|
|
+ domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
|
|
+ return Mono.just(domainSelectRes);
|
|
|
|
|
+ });
|
|
|
|
|
+ return RStatus.success(res);
|
|
|
|
|
+ }
|
|
|
|
|
+ private Mono<RStatus<DomainSelectRes>> getTakeaway(OutDomainRequest request) {
|
|
|
|
|
+ Mono<String> stringMono;
|
|
|
|
|
+ if (StrUtil.isBlank(request.getLandingPageDomain()) || request.getLandingPageDomain().trim().isEmpty()) {
|
|
|
|
|
+ stringMono = Mono.just(" ");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ stringMono = template.select(Query.query(Criteria
|
|
|
|
|
+ .where("group_type_id").is(request.getLandingPageDomain())
|
|
|
|
|
+ .and("status").is(1)
|
|
|
|
|
+ .and("deleted_at").isNull()
|
|
|
|
|
+ .and("type").is(request.getType())), DomainSelect.class)
|
|
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
|
|
+ .collectList().flatMap(fm -> {
|
|
|
|
|
+ int i = RandomUtil.randomInt(0, fm.size());
|
|
|
|
|
+ String domain = fm.get(i).domain();
|
|
|
|
|
+ String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
|
|
+ return Mono.just(string + "." + domain);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
Mono<DomainSelectRes> res = stringMono.flatMap(fff -> {
|
|
Mono<DomainSelectRes> res = stringMono.flatMap(fff -> {
|
|
|
DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
domainSelectRes.setDomain(fff);
|
|
domainSelectRes.setDomain(fff);
|