|
|
@@ -109,6 +109,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()){
|
|
|
PlanNewCommonRes res = new PlanNewCommonRes();
|
|
|
res.setCode(code);
|
|
|
@@ -141,7 +142,7 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.just(groupUserResList);
|
|
|
});
|
|
|
}
|
|
|
- return Mono.zip(Mono.just(f), groupUserResMono, imageMono, textMono).flatMap(tuple -> {
|
|
|
+ Mono<PlanNewCommonRes> planNewCommonResMono = Mono.zip(Mono.just(f), groupUserResMono, imageMono, textMono).flatMap(tuple -> {
|
|
|
PlanNewCommon plan = tuple.getT1();
|
|
|
PlanNewCommonRes res = new PlanNewCommonRes();
|
|
|
res.setCode(plan.code());
|
|
|
@@ -163,8 +164,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)) {
|
|
|
@@ -188,10 +189,24 @@ public class PlanNewCommonOutController {
|
|
|
res.setGroupImageAndTextList(h5ImageAndTextList);
|
|
|
return Mono.just(res);
|
|
|
});
|
|
|
+ int type = f.type();
|
|
|
+ if (type == 3 || type == 6 || type == 7) {
|
|
|
+ Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
+ 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;
|
|
|
+ }
|
|
|
});
|
|
|
// GZIP压缩
|
|
|
// Mono<byte[]> res = resMono.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
-
|
|
|
return RStatus.success(resMono);
|
|
|
}
|
|
|
|
|
|
@@ -1157,7 +1172,7 @@ public class PlanNewCommonOutController {
|
|
|
* @return {@link Mono}<{@link RStatus}<{@link PlanNewCommonShareRes}>>
|
|
|
*/
|
|
|
@PostMapping("planCommonShare")
|
|
|
- public Mono<RStatus<PlanNewCommonShareRes>> planCommonShare(@RequestBody PlanNewCommonShareReq request) {
|
|
|
+ public Mono<RStatus<PlanNewCommonShareRes>> planCommonShare(@RequestBody PlanNewCommonShareReq request,ServerWebExchange exchange) {
|
|
|
if (request.getCode() == null || request.getCode().isEmpty()) {
|
|
|
throw new BaseException("code不能为空");
|
|
|
}
|
|
|
@@ -1251,7 +1266,24 @@ public class PlanNewCommonOutController {
|
|
|
Mono<PlanNewCommonShareRes> resMono1 = this.setEndData(request, setFmV(setAudioV(request, resMono)));
|
|
|
// GZIP压缩
|
|
|
// Mono<byte[]> res = resMono1.flatMap(f -> Mono.just(Objects.requireNonNull(this.compressData(JSONUtil.toJsonStr(f)))));
|
|
|
- return RStatus.successList(resMono1);
|
|
|
+ Mono<PlanNewCommonShareRes> planNewCommonShareResMono = planNewCommonMono.flatMap(planNewCommon -> {
|
|
|
+ int type = planNewCommon.type();
|
|
|
+ if (type == 3 || type == 6 || type == 7) {
|
|
|
+ Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
+ return rateReturn.flatMap(bl -> {
|
|
|
+ if (bl) {
|
|
|
+ return resMono1;
|
|
|
+ } else {
|
|
|
+ PlanNewCommonShareRes dataLists = new PlanNewCommonShareRes();
|
|
|
+ //dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
+ return Mono.just(dataLists);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return resMono1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return RStatus.successList(planNewCommonShareResMono);
|
|
|
}
|
|
|
|
|
|
/**
|