|
|
@@ -54,6 +54,7 @@ import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.time.Duration;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -80,7 +81,7 @@ public class PlanNewCommonOutController {
|
|
|
@Resource
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
@Resource
|
|
|
- private ReactiveRedisTemplate<String,String> reactiveRedisTemplate;
|
|
|
+ private ReactiveRedisTemplate<String, String> reactiveRedisTemplate;
|
|
|
@Resource
|
|
|
private TakeawayServicesInterface takeawayServicesInterface;
|
|
|
@Resource
|
|
|
@@ -94,8 +95,9 @@ public class PlanNewCommonOutController {
|
|
|
private BlacklistService blacklistService;
|
|
|
|
|
|
|
|
|
- private static final String COLUMN="id,name,code,type,poster_template_id,group_id,config_json,import_domain,preview_url";
|
|
|
- private static final String[] COLUMNARRAYCOMMON=COLUMN.split(",");
|
|
|
+ private static final String COLUMN = "id,name,code,type,poster_template_id,group_id,config_json,import_domain,preview_url";
|
|
|
+ private static final String[] COLUMNARRAYCOMMON = COLUMN.split(",");
|
|
|
+
|
|
|
/**
|
|
|
* 通过 code 获取计划配置H5信息
|
|
|
*
|
|
|
@@ -110,7 +112,7 @@ public class PlanNewCommonOutController {
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("计划code异")));
|
|
|
Mono<PlanNewCommonRes> resMono = planNewCommonMono.flatMap(f -> {
|
|
|
|
|
|
- if(Objects.nonNull(f.type()) && 5==f.type()){
|
|
|
+ if (Objects.nonNull(f.type()) && 5 == f.type()) {
|
|
|
PlanNewCommonRes res = new PlanNewCommonRes();
|
|
|
res.setCode(code);
|
|
|
res.setConfigJson(f.configJson());
|
|
|
@@ -120,13 +122,13 @@ public class PlanNewCommonOutController {
|
|
|
Mono<List<GroupUserRes>> groupUserResMono = Mono.just(new ArrayList<>());
|
|
|
// 群封面
|
|
|
Mono<List<Image>> imageMono = template.select(Query.query(Criteria.where("type").is(1)
|
|
|
- .and("group_type_id").is(f.groupId())
|
|
|
- .and("deleted_at").isNull()), Image.class)
|
|
|
+ .and("group_type_id").is(f.groupId())
|
|
|
+ .and("deleted_at").isNull()), Image.class)
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("获取群封面异常"))).collectList();
|
|
|
// 群名称
|
|
|
Mono<List<Material>> textMono = template.select(Query.query(Criteria.where("type").is(4)
|
|
|
- .and("deleted_at").isNull()
|
|
|
- .and("group_type_id").is(f.groupId())), Material.class)
|
|
|
+ .and("deleted_at").isNull()
|
|
|
+ .and("group_type_id").is(f.groupId())), Material.class)
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("获取群名称异常"))).collectList();
|
|
|
if (3 == f.type()) {
|
|
|
// 交友裂变, 需要群成员
|
|
|
@@ -192,21 +194,21 @@ public class PlanNewCommonOutController {
|
|
|
int type = f.type();
|
|
|
if (type == 3 || type == 6 || type == 7) {
|
|
|
Mono<Boolean> rateReturn = blacklistService.getRateReturn1(exchange);
|
|
|
- return rateReturn.flatMap(bl->{
|
|
|
- if(bl){
|
|
|
- return planNewCommonResMono;
|
|
|
- }else {
|
|
|
+ return rateReturn.flatMap(bl -> {
|
|
|
+ if (bl) {
|
|
|
+ return planNewCommonResMono;
|
|
|
+ } else {
|
|
|
PlanNewCommonRes dataLists = new PlanNewCommonRes();
|
|
|
//dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
return Mono.just(dataLists);
|
|
|
}
|
|
|
});
|
|
|
- }else {
|
|
|
- return planNewCommonResMono;
|
|
|
+ } else {
|
|
|
+ return planNewCommonResMono;
|
|
|
}
|
|
|
});
|
|
|
// GZIP压缩
|
|
|
- // Mono<byte[]> res = resMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
+ // Mono<byte[]> res = resMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
return RStatus.success(resMono);
|
|
|
}
|
|
|
|
|
|
@@ -223,7 +225,7 @@ public class PlanNewCommonOutController {
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异")))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("计划code异")));
|
|
|
Mono<PlanNewCommonRes> resMono = planNewCommonMono.flatMap(f -> {
|
|
|
- if(Objects.nonNull(f.type()) && 5==f.type()){
|
|
|
+ if (Objects.nonNull(f.type()) && 5 == f.type()) {
|
|
|
PlanNewCommonRes res = new PlanNewCommonRes();
|
|
|
res.setCode(code);
|
|
|
res.setConfigJson(f.configJson());
|
|
|
@@ -277,8 +279,8 @@ public class PlanNewCommonOutController {
|
|
|
if (!materialList.isEmpty()) {
|
|
|
Material material = materialList.get(RandomUtil.randomInt(0, materialList.size()));
|
|
|
String content = material.content();
|
|
|
- String clientIP=null ;//exchange.getRequest().getHeaders().getFirst("X-Forwarded-For");
|
|
|
- if ( Objects.nonNull(exchange.getRequest().getRemoteAddress())) {
|
|
|
+ String clientIP = null;//exchange.getRequest().getHeaders().getFirst("X-Forwarded-For");
|
|
|
+ if (Objects.nonNull(exchange.getRequest().getRemoteAddress())) {
|
|
|
clientIP = exchange.getRequest().getRemoteAddress().getAddress().getHostAddress();
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(clientIP)) {
|
|
|
@@ -412,6 +414,7 @@ public class PlanNewCommonOutController {
|
|
|
Mono<byte[]> res = dataListsKefuMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
return RStatus.successList(res);
|
|
|
}
|
|
|
+
|
|
|
@PostMapping("kefuListCopy")
|
|
|
public Mono<RStatus<DataListsKefu>> kefuListCopy(@RequestBody KefuRequest request) {
|
|
|
Mono<PlanNewCommon> code = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())).columns(COLUMNARRAYCOMMON), PlanNewCommon.class)
|
|
|
@@ -419,15 +422,15 @@ public class PlanNewCommonOutController {
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("code查询返回结构为空")));
|
|
|
Mono<DataListsKefu> dataListsKefuMono = code.flatMap(planNew -> {
|
|
|
Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(5)
|
|
|
- .and("deleted_at").isNull()
|
|
|
- .and("group_type_id").is(planNew.groupId())), Image.class)
|
|
|
+ .and("deleted_at").isNull()
|
|
|
+ .and("group_type_id").is(planNew.groupId())), Image.class)
|
|
|
.collectList()
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))));
|
|
|
Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(11)
|
|
|
- .and("group_type_id").is(planNew.groupId())
|
|
|
- .and("deleted_at").isNull()), Material.class)
|
|
|
+ .and("group_type_id").is(planNew.groupId())
|
|
|
+ .and("deleted_at").isNull()), Material.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))))
|
|
|
@@ -491,7 +494,7 @@ public class PlanNewCommonOutController {
|
|
|
return dataListsMono;
|
|
|
});
|
|
|
// GZIP压缩
|
|
|
- // Mono<byte[]> res = dataListsKefuMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
+ // Mono<byte[]> res = dataListsKefuMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
return RStatus.successList(dataListsKefuMono);
|
|
|
}
|
|
|
|
|
|
@@ -506,32 +509,32 @@ public class PlanNewCommonOutController {
|
|
|
Mono<RStatus<DomainSelectRes>> planNew;
|
|
|
if (1 == request.getTypePlan()) {
|
|
|
// 加群裂变
|
|
|
- planNew = this.getPlanNew(request);
|
|
|
+ planNew = this.getPlanNew(request);
|
|
|
} else if (2 == request.getTypePlan()) {
|
|
|
// 听书裂变
|
|
|
planNew = this.getListeningPlan(request);
|
|
|
- } else if (3 == request.getTypePlan() ||6 == request.getTypePlan()) {
|
|
|
+ } else if (3 == request.getTypePlan() || 6 == request.getTypePlan()) {
|
|
|
// 交友裂变
|
|
|
planNew = this.getFriendPlan(request);
|
|
|
} else if (7 == request.getTypePlan()) {
|
|
|
- planNew = this.getAlbum(request,exchange);
|
|
|
- }else if (4 == request.getTypePlan()) {
|
|
|
+ planNew = this.getAlbum(request, exchange);
|
|
|
+ } else if (4 == request.getTypePlan()) {
|
|
|
planNew = this.getTakeaway(request);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 交友裂变
|
|
|
planNew = this.getFriendPlan(request);
|
|
|
}
|
|
|
Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
- return rateReturn.flatMap(bl->{
|
|
|
- if(bl){
|
|
|
- return planNew ;
|
|
|
- }else {
|
|
|
+ return rateReturn.flatMap(bl -> {
|
|
|
+ if (bl) {
|
|
|
+ return planNew;
|
|
|
+ } else {
|
|
|
DomainSelectRes dataLists = new DomainSelectRes();
|
|
|
dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
- return RStatus.fail("1","",Mono.just(dataLists));
|
|
|
+ return RStatus.fail("1", "", Mono.just(dataLists));
|
|
|
}
|
|
|
});
|
|
|
- // throw new BaseException("typePlan 类型错误");
|
|
|
+ // throw new BaseException("typePlan 类型错误");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -715,16 +718,17 @@ public class PlanNewCommonOutController {
|
|
|
});
|
|
|
return RStatus.success(res);
|
|
|
}
|
|
|
+
|
|
|
private Mono<RStatus<DomainSelectRes>> getAlbum(OutDomainRequest request, ServerWebExchange exchange) {
|
|
|
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)
|
|
|
+ .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 BaseException("查询domain 返回结果为空")))
|
|
|
.collectList().flatMap(fm -> {
|
|
|
@@ -737,10 +741,10 @@ public class PlanNewCommonOutController {
|
|
|
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)
|
|
|
+ .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 BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
@@ -758,10 +762,10 @@ public class PlanNewCommonOutController {
|
|
|
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)
|
|
|
+ .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 BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
@@ -789,14 +793,14 @@ public class PlanNewCommonOutController {
|
|
|
if (split.length > 1) {
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
- if(i!=0){
|
|
|
+ if (i != 0) {
|
|
|
stringBuilder.append(split[i]);
|
|
|
}
|
|
|
}
|
|
|
- t1=stringBuilder.toString();
|
|
|
+ t1 = stringBuilder.toString();
|
|
|
}
|
|
|
}
|
|
|
- String md5 = SecureUtil.md5(s+t1);
|
|
|
+ String md5 = SecureUtil.md5(s + t1);
|
|
|
domainSelectRes.setUnique(md5);
|
|
|
return Mono.just(domainSelectRes);
|
|
|
});
|
|
|
@@ -804,7 +808,7 @@ public class PlanNewCommonOutController {
|
|
|
}
|
|
|
|
|
|
//用户ID的生成逻辑调整,改为ip+ua+落地一级域名的形式生成用户ID(效果:用户在不同的落地页里都需要解锁同一相册)
|
|
|
- public String setUnique(ServerWebExchange exchange){
|
|
|
+ public String setUnique(ServerWebExchange exchange) {
|
|
|
ServerHttpRequest httpRequest = exchange.getRequest();
|
|
|
InetSocketAddress remoteAddress = httpRequest.getRemoteAddress();
|
|
|
// 从请求头中获取 User-Agent
|
|
|
@@ -854,7 +858,7 @@ public class PlanNewCommonOutController {
|
|
|
@PostMapping("getCommonMaterial")
|
|
|
public Mono<RStatus<PlanNewCommonMaterialRes>> getCommonMaterial(@RequestBody PlanNewCommonMaterialReq request) {
|
|
|
Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("code").is(request.getCode()))
|
|
|
- .columns(COLUMNARRAYCOMMON), PlanNewCommon.class)
|
|
|
+ .columns(COLUMNARRAYCOMMON), PlanNewCommon.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空")))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("计划code异常")));
|
|
|
Mono<PlanNewCommonMaterialRes> materialResMono = planNewCommonMono.flatMap(plan -> {
|
|
|
@@ -868,8 +872,8 @@ public class PlanNewCommonOutController {
|
|
|
returnLoop = Mono.just(getReturnLoop());
|
|
|
} else {
|
|
|
returnLoop = template.selectOne(Query.query(Criteria.where("id").is(request.getReturnLoopId())
|
|
|
- .and("deleted_at").isNull())
|
|
|
- .columns("id,name,group_type,group_type_name,group_type_id,domain,is_show_list,return_list,return_number,type,domain_id".split(",")), ReturnLoop.class)
|
|
|
+ .and("deleted_at").isNull())
|
|
|
+ .columns("id,name,group_type,group_type_name,group_type_id,domain,is_show_list,return_list,return_number,type,domain_id".split(",")), ReturnLoop.class)
|
|
|
.switchIfEmpty(Mono.just(getReturnLoop()))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("查询返回广告异常")));
|
|
|
}
|
|
|
@@ -891,57 +895,58 @@ public class PlanNewCommonOutController {
|
|
|
} else {
|
|
|
takeaway = Mono.just(new TakeawayH5Data());
|
|
|
}
|
|
|
- Mono<List<Ad>> adtop ;
|
|
|
+ Mono<List<Ad>> adtop;
|
|
|
if (Objects.nonNull(request.getTopAdvBl()) && request.getTopAdvBl()) {
|
|
|
- if(6==plan.type()){
|
|
|
+ if (6 == plan.type()) {
|
|
|
adtop = template.select(Query.query(Criteria.where("type").is(1).and("group_type_id").is(plan.groupId())
|
|
|
- .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link,redirect_type,plan_type,plan_id,group_type_id".split(",")), Ad.class)
|
|
|
- .switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划营销分类:{};查询顶部广告返回结果为空",plan.groupId()))))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"4")))
|
|
|
+ .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link,redirect_type,plan_type,plan_id,group_type_id".split(",")), Ad.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划营销分类:{};查询顶部广告返回结果为空", plan.groupId()))))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage() + "4")))
|
|
|
.collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
adtop = template.select(Query.query(Criteria.where("type").is(1)
|
|
|
- .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link".split(",")), Ad.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"4")))
|
|
|
+ .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link".split(",")), Ad.class)
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage() + "4")))
|
|
|
.collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
}
|
|
|
- }else {
|
|
|
- adtop=Mono.just(List.of());
|
|
|
+ } else {
|
|
|
+ adtop = Mono.just(List.of());
|
|
|
}
|
|
|
- Mono<List<Ad>> adBottom ;
|
|
|
+ Mono<List<Ad>> adBottom;
|
|
|
if (Objects.nonNull(request.getBottomAdvBl()) && request.getBottomAdvBl()) {
|
|
|
//假视频,相册
|
|
|
- if (Set.of(6,7).contains(plan.type())) {
|
|
|
+ if (Set.of(6, 7).contains(plan.type())) {
|
|
|
adBottom = template.select(Query.query(Criteria.where("type").is(2).and("group_type_id").is(plan.groupId())
|
|
|
- .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link,redirect_type,plan_type,plan_id,group_type_id".split(",")), Ad.class)
|
|
|
+ .and("show_end_at").greaterThan(LocalDateTime.now())
|
|
|
+ .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link,redirect_type,plan_type,plan_id,group_type_id".split(",")), Ad.class)
|
|
|
.collectList().switchIfEmpty(Mono.just(List.of()));////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
adBottom = template.select(Query.query(Criteria.where("type").is(2)
|
|
|
- .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link".split(",")), Ad.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"4")))
|
|
|
+ .and("deleted_at").isNull()).columns("id,name,type,image,show_beg_at,show_end_at,link".split(",")), Ad.class)
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage() + "4")))
|
|
|
.collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
}
|
|
|
|
|
|
- }else {
|
|
|
- adBottom=Mono.just(List.of());
|
|
|
+ } else {
|
|
|
+ adBottom = Mono.just(List.of());
|
|
|
}
|
|
|
//假视频
|
|
|
- Mono<List<Image>> imageMono ;
|
|
|
- if (Objects.nonNull(plan.type()) && 6==plan.type()) {
|
|
|
+ Mono<List<Image>> imageMono;
|
|
|
+ if (Objects.nonNull(plan.type()) && 6 == plan.type()) {
|
|
|
imageMono = template.select(Query.query(Criteria.where("type").is(13)
|
|
|
- .and("group_type_id").is(plan.groupId())
|
|
|
- .and("deleted_at").isNull()), Image.class)
|
|
|
+ .and("group_type_id").is(plan.groupId())
|
|
|
+ .and("deleted_at").isNull()), Image.class)
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("获取假视频计划图片异常"))).collectList();
|
|
|
- }else {
|
|
|
- imageMono=Mono.just(List.of());
|
|
|
+ } else {
|
|
|
+ imageMono = Mono.just(List.of());
|
|
|
}
|
|
|
Mono<Ad> adTop1 = adtop.flatMap(t6 -> {
|
|
|
Mono<Ad> adMono = Mono.just(new Ad(null, null, null, null, null
|
|
|
, null, null, null, null, null, null, null, null, null));
|
|
|
if (!t6.isEmpty()) {
|
|
|
Ad ad = t6.get(RandomUtil.randomInt(0, t6.size()));
|
|
|
- if(6==plan.type() && Objects.nonNull(request.getTopAdvBl()) && request.getTopAdvBl()){
|
|
|
- if (Objects.nonNull(ad.redirectType()) && ad.redirectType() == 1 && Objects.nonNull(ad.planId())&& Objects.nonNull(ad.planType())) {
|
|
|
+ if (6 == plan.type() && Objects.nonNull(request.getTopAdvBl()) && request.getTopAdvBl()) {
|
|
|
+ if (Objects.nonNull(ad.redirectType()) && ad.redirectType() == 1 && Objects.nonNull(ad.planId()) && Objects.nonNull(ad.planType())) {
|
|
|
Mono<String> byCodeGetImportDomainResMono = getByCodeGetImportDomainResMono(ad.planId(), ad.planType()).switchIfEmpty(Mono.just(""));
|
|
|
adMono = Mono.zip(Mono.just(ad), byCodeGetImportDomainResMono).flatMap(tuple -> {
|
|
|
Ad t1 = tuple.getT1();
|
|
|
@@ -952,10 +957,10 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.just(ad1);
|
|
|
});
|
|
|
} else {
|
|
|
- adMono=Mono.just(ad);
|
|
|
+ adMono = Mono.just(ad);
|
|
|
}
|
|
|
- }else {
|
|
|
- adMono=Mono.just(ad);
|
|
|
+ } else {
|
|
|
+ adMono = Mono.just(ad);
|
|
|
}
|
|
|
}
|
|
|
return adMono;
|
|
|
@@ -965,8 +970,8 @@ public class PlanNewCommonOutController {
|
|
|
, null, null, null, null, null, null, null, null, null));
|
|
|
if (!t6.isEmpty()) {
|
|
|
Ad ad = t6.get(RandomUtil.randomInt(0, t6.size()));
|
|
|
- if(6==plan.type() && Objects.nonNull(request.getBottomAdvBl()) && request.getBottomAdvBl()){
|
|
|
- if (Objects.nonNull(ad.redirectType()) && ad.redirectType() == 1 && Objects.nonNull(ad.planId())&& Objects.nonNull(ad.planType())) {
|
|
|
+ if (6 == plan.type() && Objects.nonNull(request.getBottomAdvBl()) && request.getBottomAdvBl()) {
|
|
|
+ if (Objects.nonNull(ad.redirectType()) && ad.redirectType() == 1 && Objects.nonNull(ad.planId()) && Objects.nonNull(ad.planType())) {
|
|
|
Mono<String> byCodeGetImportDomainResMono = getByCodeGetImportDomainResMono(ad.planId(), ad.planType()).switchIfEmpty(Mono.just(""));
|
|
|
adMono = Mono.zip(Mono.just(ad), byCodeGetImportDomainResMono).flatMap(tuple -> {
|
|
|
Ad t1 = tuple.getT1();
|
|
|
@@ -977,10 +982,10 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.just(ad1);
|
|
|
});
|
|
|
} else {
|
|
|
- adMono=Mono.just(ad);
|
|
|
+ adMono = Mono.just(ad);
|
|
|
}
|
|
|
- }else {
|
|
|
- adMono=Mono.just(ad);
|
|
|
+ } else {
|
|
|
+ adMono = Mono.just(ad);
|
|
|
}
|
|
|
}
|
|
|
return adMono;
|
|
|
@@ -999,7 +1004,7 @@ public class PlanNewCommonOutController {
|
|
|
// }
|
|
|
Mono<List<Long>> album_id = template.select(Query.query(Criteria.where("group_id").is(plan.groupId())).columns("album_id"), Album.class)
|
|
|
.flatMap(album -> Mono.just(album.albumId())).collectList();
|
|
|
- return album_id.flatMap(lists -> {
|
|
|
+ return album_id.flatMap(lists -> {
|
|
|
if (lists.isEmpty() || lists.size() < request.getAlbumNum()) {
|
|
|
return Mono.error(new BaseException(StrUtil.format("相册素材数:{};计划要求素材数:{} 不匹配", lists.size(), request.getAlbumNum())));
|
|
|
}
|
|
|
@@ -1009,7 +1014,7 @@ public class PlanNewCommonOutController {
|
|
|
Long aLong = collect.get(RandomUtil.randomInt(0, collect.size()));
|
|
|
longs.add(aLong);
|
|
|
}
|
|
|
- return Flux.fromIterable(longs).flatMap(id -> sourceMaterialInterface.infoAlbum(id)).collectList();
|
|
|
+ return Flux.fromIterable(longs).flatMap(id -> sourceMaterialInterface.infoAlbum(id)).collectList();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
@@ -1040,17 +1045,17 @@ public class PlanNewCommonOutController {
|
|
|
});
|
|
|
Mono<List<DuanjuMaterialRes>> duanju = Mono.just(List.of());
|
|
|
Mono<List<H5ImageAndText>> kefu = Mono.just(List.of());
|
|
|
- if (plan.type() == 8 &&Objects.nonNull(request.getImageAndTxtNum())&& request.getImageAndTxtNum() > 0) {
|
|
|
+ if (plan.type() == 8 && Objects.nonNull(request.getImageAndTxtNum()) && request.getImageAndTxtNum() > 0) {
|
|
|
Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(5)
|
|
|
- .and("deleted_at").isNull()
|
|
|
- .and("group_type_id").is(plan.groupId())), Image.class)
|
|
|
+ .and("deleted_at").isNull()
|
|
|
+ .and("group_type_id").is(plan.groupId())), Image.class)
|
|
|
.collectList()
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结构为空", plan.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", plan.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))));
|
|
|
Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(11)
|
|
|
- .and("group_type_id").is(plan.groupId())
|
|
|
- .and("deleted_at").isNull()), Material.class)
|
|
|
+ .and("group_type_id").is(plan.groupId())
|
|
|
+ .and("deleted_at").isNull()), Material.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结构为空", plan.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", plan.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))))
|
|
|
@@ -1084,39 +1089,39 @@ public class PlanNewCommonOutController {
|
|
|
});
|
|
|
return Mono.just(h5ImageAndTexts);
|
|
|
});
|
|
|
- duanju= template.select(Query.query(Criteria.where("group_type_id").is(plan.groupId()).and("deleted_at").isNull()),DuanjuMaterial.class)
|
|
|
+ duanju = template.select(Query.query(Criteria.where("group_type_id").is(plan.groupId()).and("deleted_at").isNull()), DuanjuMaterial.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询DuanjuMaterial返回结构为空", plan.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询DuanjuMaterial返回结果error:{}", plan.groupId(),
|
|
|
LogExceptionStackTrace.erroStackTrace(throwable).toString()))))
|
|
|
- .collectList().flatMap(list->{
|
|
|
- if (list.size() < request.getImageAndTxtNum()) {
|
|
|
- return Mono.error(new BaseException("短剧素材数量小于计划设置数"));
|
|
|
- }
|
|
|
- ArrayList<Long> listImg = new ArrayList<>();
|
|
|
- List<DuanjuMaterialRes> dJ = new ArrayList<>();
|
|
|
- IntStream.range(0, request.getImageAndTxtNum()).forEach(i -> {
|
|
|
- DuanjuMaterialRes duanjuMaterialRes = new DuanjuMaterialRes();
|
|
|
- List<DuanjuMaterial> collect = list.stream().filter(fff -> !listImg.contains(fff.id())).toList();
|
|
|
- if (!collect.isEmpty()) {
|
|
|
- DuanjuMaterial duanjuMaterial = collect.get(RandomUtil.randomInt(0, collect.size()));
|
|
|
- listImg.add(duanjuMaterial.id());
|
|
|
- duanjuMaterialRes.setImage(duanjuMaterial.thumb());
|
|
|
- duanjuMaterialRes.setTag(duanjuMaterial.tag());
|
|
|
- duanjuMaterialRes.setName(duanjuMaterial.title());
|
|
|
- }
|
|
|
- dJ.add(duanjuMaterialRes);
|
|
|
- });
|
|
|
- return Mono.just(dJ);
|
|
|
- });
|
|
|
+ .collectList().flatMap(list -> {
|
|
|
+ if (list.size() < request.getImageAndTxtNum()) {
|
|
|
+ return Mono.error(new BaseException("短剧素材数量小于计划设置数"));
|
|
|
+ }
|
|
|
+ ArrayList<Long> listImg = new ArrayList<>();
|
|
|
+ List<DuanjuMaterialRes> dJ = new ArrayList<>();
|
|
|
+ IntStream.range(0, request.getImageAndTxtNum()).forEach(i -> {
|
|
|
+ DuanjuMaterialRes duanjuMaterialRes = new DuanjuMaterialRes();
|
|
|
+ List<DuanjuMaterial> collect = list.stream().filter(fff -> !listImg.contains(fff.id())).toList();
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
+ DuanjuMaterial duanjuMaterial = collect.get(RandomUtil.randomInt(0, collect.size()));
|
|
|
+ listImg.add(duanjuMaterial.id());
|
|
|
+ duanjuMaterialRes.setImage(duanjuMaterial.thumb());
|
|
|
+ duanjuMaterialRes.setTag(duanjuMaterial.tag());
|
|
|
+ duanjuMaterialRes.setName(duanjuMaterial.title());
|
|
|
+ }
|
|
|
+ dJ.add(duanjuMaterialRes);
|
|
|
+ });
|
|
|
+ return Mono.just(dJ);
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
- return Mono.zip(planNewCommonMaterialResMono,albumList,duanju,kefu).flatMap(tuple->{
|
|
|
+ return Mono.zip(planNewCommonMaterialResMono, albumList, duanju, kefu).flatMap(tuple -> {
|
|
|
List<AlbumReq> t2 = tuple.getT2();
|
|
|
PlanNewCommonMaterialRes t1 = tuple.getT1();
|
|
|
- if(!t2.isEmpty()){
|
|
|
- // String s = JSONUtil.toJsonStr(t2);
|
|
|
- // reactiveRedisTemplate.opsForValue().set(request.getUnique() + "_albumList",s, Duration.ofHours(2L)).subscribe();
|
|
|
+ if (!t2.isEmpty()) {
|
|
|
+ // String s = JSONUtil.toJsonStr(t2);
|
|
|
+ // reactiveRedisTemplate.opsForValue().set(request.getUnique() + "_albumList",s, Duration.ofHours(2L)).subscribe();
|
|
|
t1.setAlbumList(t2);
|
|
|
}
|
|
|
t1.setDJs(tuple.getT3());
|
|
|
@@ -1136,7 +1141,7 @@ public class PlanNewCommonOutController {
|
|
|
if (Objects.isNull(id) || id <= 0) {
|
|
|
return Mono.just(getAudio());
|
|
|
}
|
|
|
- String col="id,url,name,type";
|
|
|
+ String col = "id,url,name,type";
|
|
|
return template.selectOne(Query.query(Criteria.where("id").is(id)).columns(col.split(",")), Audio.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频为空", id))))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::{}", id, throwable.getMessage()))));
|
|
|
@@ -1164,6 +1169,7 @@ public class PlanNewCommonOutController {
|
|
|
private ReturnLoop getReturnLoop() {
|
|
|
return new ReturnLoop(-1L, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* H5分享
|
|
|
*
|
|
|
@@ -1171,12 +1177,12 @@ public class PlanNewCommonOutController {
|
|
|
* @return {@link Mono}<{@link RStatus}<{@link PlanNewCommonShareRes}>>
|
|
|
*/
|
|
|
@PostMapping("planCommonShare")
|
|
|
- public Mono<RStatus<PlanNewCommonShareRes>> planCommonShare(@RequestBody PlanNewCommonShareReq request,ServerWebExchange exchange) {
|
|
|
+ public Mono<RStatus<PlanNewCommonShareRes>> planCommonShare(@RequestBody PlanNewCommonShareReq request, ServerWebExchange exchange) {
|
|
|
if (request.getCode() == null || request.getCode().isEmpty()) {
|
|
|
throw new BaseException("code不能为空");
|
|
|
}
|
|
|
Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("code").is(request.getCode()))
|
|
|
- .columns(COLUMNARRAYCOMMON), PlanNewCommon.class)
|
|
|
+ .columns(COLUMNARRAYCOMMON), PlanNewCommon.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(" code错误")));
|
|
|
// 记录访问
|
|
|
@@ -1189,11 +1195,11 @@ public class PlanNewCommonOutController {
|
|
|
// 交友裂变无清水分类
|
|
|
isQs = false;
|
|
|
}
|
|
|
- if (Objects.nonNull(request.getRedirectType()) && request.getRedirectType() == 2 ) {
|
|
|
+ if (Objects.nonNull(request.getRedirectType()) && request.getRedirectType() == 2) {
|
|
|
stringBuilderMono = goGenerateService.byPlanNewIdGetUrlCommon(request.getRedirectPlanId(), isQs, request.getGroupIdQs());
|
|
|
- } else if(7 == plan.type()){
|
|
|
+ } else if (7 == plan.type()) {
|
|
|
stringBuilderMono = Mono.just(new StringBuilder(request.getLink() == null ? "空" : request.getLink()));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
stringBuilderMono = Mono.just(new StringBuilder(request.getLink() == null ? "" : request.getLink()));
|
|
|
}
|
|
|
Mono<PlanNewCommon> code = Mono.just(plan);
|
|
|
@@ -1282,7 +1288,7 @@ public class PlanNewCommonOutController {
|
|
|
return resMono1;
|
|
|
}
|
|
|
});
|
|
|
- return RStatus.successList(planNewCommonShareResMono);
|
|
|
+ return RStatus.successList(planNewCommonShareResMono);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1305,37 +1311,37 @@ public class PlanNewCommonOutController {
|
|
|
goRequest = setNameVal(posterTemplate, fxSetting, fm.getSpare());
|
|
|
}
|
|
|
QrcodeInfo stringBuilder = getQrcodeInfo(goRequest);
|
|
|
- Mono<QrcodeInfo> qrcodeInfoMono=Mono.just(new QrcodeInfo(null,null,null,null));
|
|
|
+ Mono<QrcodeInfo> qrcodeInfoMono = Mono.just(new QrcodeInfo(null, null, null, null));
|
|
|
List<Item> collect = goRequest.getItem()
|
|
|
.stream()
|
|
|
.filter(filter -> "cusqrcode".equals(filter.getT())
|
|
|
&& filter.getIsRandom()
|
|
|
&& 1 == filter.getType()).collect(Collectors.toList());
|
|
|
if (!collect.isEmpty()) {
|
|
|
- qrcodeInfoMono = template.insert(stringBuilder)
|
|
|
+ qrcodeInfoMono = template.insert(stringBuilder)
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException("插入QrcodeInfo异常::::" + throwable.getMessage())));
|
|
|
}
|
|
|
|
|
|
- return Mono.zip(Mono.just(fm),qrcodeInfoMono).flatMap(fm1->{
|
|
|
+ return Mono.zip(Mono.just(fm), qrcodeInfoMono).flatMap(fm1 -> {
|
|
|
if (Objects.nonNull(fm1.getT2().id())) {
|
|
|
goRequest.getItem()
|
|
|
.stream()
|
|
|
.filter(filter -> "cusqrcode".equals(filter.getT())
|
|
|
&& filter.getIsRandom()
|
|
|
&& 1 == filter.getType()).collect(Collectors.toList()).forEach(fe -> {
|
|
|
- if (Objects.nonNull(fe.getV())) {
|
|
|
- if (fe.getV().contains("?")){
|
|
|
- String cusqrcode = fe.getV() + "&id=" + fm1.getT2().id();
|
|
|
- fe.setV(cusqrcode);
|
|
|
- }else{
|
|
|
- String cusqrcode = fe.getV() + "?id=" + fm1.getT2().id();
|
|
|
- fe.setV(cusqrcode);
|
|
|
- }
|
|
|
+ if (Objects.nonNull(fe.getV())) {
|
|
|
+ if (fe.getV().contains("?")) {
|
|
|
+ String cusqrcode = fe.getV() + "&id=" + fm1.getT2().id();
|
|
|
+ fe.setV(cusqrcode);
|
|
|
+ } else {
|
|
|
+ String cusqrcode = fe.getV() + "?id=" + fm1.getT2().id();
|
|
|
+ fe.setV(cusqrcode);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- String ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
+ String ret = goGenerateService.goGenerate(JSONUtil.toJsonStr(goRequest));
|
|
|
if (Objects.nonNull(ret)) {
|
|
|
JSONObject jsonObject1;
|
|
|
try {
|
|
|
@@ -1361,12 +1367,14 @@ public class PlanNewCommonOutController {
|
|
|
});
|
|
|
return resMono1;
|
|
|
}
|
|
|
- private QrcodeInfo getQrcodeInfo(GoRequest goRequest) {
|
|
|
- Optional<Item> first = goRequest.getItem().stream().filter(ff -> "cover".equals(ff.getT()) ).findFirst();
|
|
|
+
|
|
|
+ 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():"",first3.isPresent()?first3.get().getRemark():"");
|
|
|
+ QrcodeInfo qrcodeInfo = new QrcodeInfo(null, first.isPresent() ? first.get().getV() : "", first3.isPresent() ? first3.get().getV() : "", first3.isPresent() ? first3.get().getRemark() : "");
|
|
|
return qrcodeInfo;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* qrcode 二维码设置
|
|
|
*/
|
|
|
@@ -1487,7 +1495,7 @@ public class PlanNewCommonOutController {
|
|
|
|
|
|
private Mono<List<Poster>> getPoster(Mono<PlanNewCommon> code) {
|
|
|
return code.flatMap(plan -> template.select(Query.query(Criteria.where("poster_template_id")
|
|
|
- .is(plan.posterTemplateId())).sort(Sort.by(Sort.Order.asc("created_at")))
|
|
|
+ .is(plan.posterTemplateId())).sort(Sort.by(Sort.Order.asc("created_at")))
|
|
|
.columns("poster_id,poster_template_id,poster_template,generate_images_json,generate_images_url".split(",")), Poster.class).collectList());
|
|
|
}
|
|
|
|
|
|
@@ -1501,11 +1509,11 @@ public class PlanNewCommonOutController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public Mono<String> getByCodeGetImportDomainResMono(String planId,Integer planType) {
|
|
|
+ public Mono<String> getByCodeGetImportDomainResMono(String planId, Integer planType) {
|
|
|
Query query0 = Query.query(Criteria.where("plan_new_id").is(planId));
|
|
|
- Mono<Long> planNew = Mono.just(0L);
|
|
|
+ Mono<Long> planNew = Mono.just(0L);
|
|
|
if (1 == planType) {
|
|
|
- planNew = template.count(query0, PlanNew.class)
|
|
|
+ planNew = template.count(query0, PlanNew.class)
|
|
|
.onErrorResume(throwable ->
|
|
|
Mono.error(new Exception(StrUtil
|
|
|
.format("通过planid:{}查询是否裂变计划异常:::{}",
|
|
|
@@ -1513,7 +1521,7 @@ public class PlanNewCommonOutController {
|
|
|
throwable.getMessage()))));
|
|
|
}
|
|
|
Query query1 = Query.query(Criteria.where("listening_plan_new_id").is(planId));
|
|
|
- Mono<Long> listeningPlan = Mono.just(0L) ;
|
|
|
+ Mono<Long> listeningPlan = Mono.just(0L);
|
|
|
if (2 == planType) {
|
|
|
listeningPlan = template
|
|
|
.count(query1, ListeningPlanNew.class)
|
|
|
@@ -1523,7 +1531,7 @@ public class PlanNewCommonOutController {
|
|
|
planId,
|
|
|
throwable.getMessage()))));
|
|
|
}
|
|
|
- Mono<Long> common = Mono.just(0L) ;
|
|
|
+ Mono<Long> common = Mono.just(0L);
|
|
|
Query query2 = Query.query(Criteria.where("id").is(planId));
|
|
|
if (planType > 2) {
|
|
|
common = template
|
|
|
@@ -1535,7 +1543,7 @@ public class PlanNewCommonOutController {
|
|
|
throwable.getMessage()))));
|
|
|
}
|
|
|
Mono<String> stringBuilderMono1 = Mono
|
|
|
- .zip(planNew, listeningPlan,common)
|
|
|
+ .zip(planNew, listeningPlan, common)
|
|
|
.flatMap(f -> {
|
|
|
Long t1 = f.getT1();
|
|
|
Long t2 = f.getT2();
|
|
|
@@ -1545,12 +1553,12 @@ public class PlanNewCommonOutController {
|
|
|
stringBuilderMono = getNewPlan(planId, query0);
|
|
|
} else if (t2 > 0) {
|
|
|
stringBuilderMono = getNewListeningNewPlan(planId, query1);
|
|
|
- } else if(t3>0){
|
|
|
+ } else if (t3 > 0) {
|
|
|
stringBuilderMono = getNewPlanCommon(planId, query2);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new BaseException("planId不存在");
|
|
|
}
|
|
|
- return stringBuilderMono.flatMap(f1->Mono.just(f1.getDomain()));
|
|
|
+ return stringBuilderMono.flatMap(f1 -> Mono.just(f1.getDomain()));
|
|
|
});
|
|
|
return stringBuilderMono1;
|
|
|
}
|
|
|
@@ -1572,38 +1580,39 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.error(new BaseException("查询common计划 importDomain 值为 null"));
|
|
|
}
|
|
|
Long groupId = Long.valueOf(ff.importDomain());
|
|
|
- if(Objects.nonNull(ff.type()) && 5==ff.type()){
|
|
|
+ if (Objects.nonNull(ff.type()) && 5 == ff.type()) {
|
|
|
String configJson = ff.configJson();
|
|
|
- if(Objects.nonNull(configJson) ){
|
|
|
+ if (Objects.nonNull(configJson)) {
|
|
|
JSONObject jsonObject;
|
|
|
try {
|
|
|
jsonObject = JSONUtil.parseObj(configJson);
|
|
|
- }catch (Exception e){
|
|
|
- throw new BaseException("解析configJson异常"+e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BaseException("解析configJson异常" + e.getMessage());
|
|
|
}
|
|
|
- if(!jsonObject.containsKey("landingPageDomain")){
|
|
|
+ if (!jsonObject.containsKey("landingPageDomain")) {
|
|
|
throw new BaseException("解析configJson 不包含字段 landingPageDomain");
|
|
|
}
|
|
|
try {
|
|
|
groupId = jsonObject.get("landingPageDomain", Long.class);
|
|
|
- }catch (Exception e){
|
|
|
- throw new BaseException("解析landingPageDomain异常"+e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BaseException("解析landingPageDomain异常" + e.getMessage());
|
|
|
}
|
|
|
// String s = byCustomerIdGetUrl(posterCustomerServiceId);
|
|
|
//return Mono.just(new StringBuilder(s));
|
|
|
}
|
|
|
//saveRequest.setImportDomain(String.valueOf(saveRequest.getGroupId()));
|
|
|
- return getDomainSetV(groupId, planId,2, ff.code(),false,false);
|
|
|
- }else {
|
|
|
- if (3 == ff.type() || 4==ff.type()) {
|
|
|
- return getDomainSetV(groupId, planId,1, ff.code(),true,false);
|
|
|
- }else {
|
|
|
- return getDomainSetV(groupId, planId,1, ff.code(),false,false);
|
|
|
+ return getDomainSetV(groupId, planId, 2, ff.code(), false, false);
|
|
|
+ } else {
|
|
|
+ if (3 == ff.type() || 4 == ff.type()) {
|
|
|
+ return getDomainSetV(groupId, planId, 1, ff.code(), true, false);
|
|
|
+ } else {
|
|
|
+ return getDomainSetV(groupId, planId, 1, ff.code(), false, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
private Mono<ByCodeGetImportDomainRes> getNewListeningNewPlan(String planId, Query query) {
|
|
|
return template.selectOne(query, ListeningPlanNew.class)
|
|
|
.switchIfEmpty(Mono
|
|
|
@@ -1621,7 +1630,7 @@ public class PlanNewCommonOutController {
|
|
|
if (Objects.isNull(groupId)) {
|
|
|
return Mono.error(new BaseException("查询裂变计划 groupId 值为 null"));
|
|
|
}
|
|
|
- return getDomainSetV(groupId, planId,1, ff.code(),false,false);
|
|
|
+ return getDomainSetV(groupId, planId, 1, ff.code(), false, false);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -1645,19 +1654,19 @@ public class PlanNewCommonOutController {
|
|
|
long groupId;
|
|
|
try {
|
|
|
groupId = Long.parseLong(groupIdStr);
|
|
|
- }catch (Exception e){
|
|
|
- return Mono.error(new BaseException("查询听书计划入口域名类型值解析错误"+e.getMessage()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ return Mono.error(new BaseException("查询听书计划入口域名类型值解析错误" + e.getMessage()));
|
|
|
}
|
|
|
- return getDomainSetV(groupId, planId,1,ff.code(),false,true);
|
|
|
+ return getDomainSetV(groupId, planId, 1, ff.code(), false, true);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private Mono<ByCodeGetImportDomainRes> getDomainSetV( Long groupId, String planId,Integer type,String code,boolean isFri,boolean isAddGroup) {
|
|
|
+ private Mono<ByCodeGetImportDomainRes> getDomainSetV(Long groupId, String planId, Integer type, String code, boolean isFri, boolean isAddGroup) {
|
|
|
return template.select(Query.query(Criteria.where("group_type_id").is(groupId)
|
|
|
- .and("status").is(1)
|
|
|
- .and("type").is(type)
|
|
|
- .and("deleted_at").isNull()),
|
|
|
- DomainSelect.class)
|
|
|
+ .and("status").is(1)
|
|
|
+ .and("type").is(type)
|
|
|
+ .and("deleted_at").isNull()),
|
|
|
+ DomainSelect.class)
|
|
|
.collectList()
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil
|
|
|
.format("通过planId:{},groupId:{};查询域名为空",
|
|
|
@@ -1671,17 +1680,17 @@ public class PlanNewCommonOutController {
|
|
|
throwable.getMessage()))))
|
|
|
.flatMap(f2 -> {
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
- if(!f2.isEmpty()){
|
|
|
+ if (!f2.isEmpty()) {
|
|
|
DomainSelect domainSelect = f2.get(RandomUtil.randomInt(0, f2.size()));
|
|
|
stringBuilder.append("http://");
|
|
|
stringBuilder.append(get6Str(code));
|
|
|
stringBuilder.append(".");
|
|
|
stringBuilder.append(domainSelect.domain());
|
|
|
- if(2==type){
|
|
|
+ if (2 == type) {
|
|
|
stringBuilder.append("?code=");
|
|
|
- }else if(isFri) {
|
|
|
+ } else if (isFri) {
|
|
|
stringBuilder.append("/portal-page/index?code=");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
stringBuilder.append("/index.html?code=");
|
|
|
}
|
|
|
stringBuilder.append(code);
|
|
|
@@ -1690,14 +1699,15 @@ public class PlanNewCommonOutController {
|
|
|
if (isAddGroup) {
|
|
|
stringBuilder.append("&id=57");
|
|
|
}
|
|
|
- }else {
|
|
|
- return Mono.error(new BaseException(StrUtil.format("通过code:{},groupId:{};查询域名Error::{}",code,groupId,"错误")));
|
|
|
+ } else {
|
|
|
+ return Mono.error(new BaseException(StrUtil.format("通过code:{},groupId:{};查询域名Error::{}", code, groupId, "错误")));
|
|
|
}
|
|
|
ByCodeGetImportDomainRes domain = new ByCodeGetImportDomainRes();
|
|
|
domain.setDomain(stringBuilder.toString());
|
|
|
return Mono.just(domain);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
private String get6Str(String code) {
|
|
|
return RandomStr.getRandomStr(code);
|
|
|
}
|