|
|
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+
|
|
|
import com.webflux.launchadmin.config.BaseContextHandler;
|
|
|
import com.webflux.launchadmin.global.BaseException;
|
|
|
import com.webflux.launchadmin.mysql.controller.planNew.req.*;
|
|
|
@@ -18,10 +19,13 @@ import com.webflux.launchadmin.mysql.service.planNew.ipAnalyze.IpAnalyzeServiceI
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
+import com.weblux.launchredis.utils.RedisKey;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
|
import org.springframework.data.relational.core.query.Query;
|
|
|
import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
|
@@ -60,6 +64,9 @@ public class PlanNewOutController {
|
|
|
@Resource
|
|
|
private IpAnalyzeServiceInterface ipAnalyzeServiceInterface;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StringRedisTemplate stringRedisTemplate;
|
|
|
+
|
|
|
|
|
|
|
|
|
private static final ConcurrentHashMap<String,Integer> map = new ConcurrentHashMap<String,Integer>();
|
|
|
@@ -171,10 +178,16 @@ public class PlanNewOutController {
|
|
|
});
|
|
|
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())));
|
|
|
- Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria.where("group_type_id").is(f.groupId())
|
|
|
+ Object planCache = stringRedisTemplate.opsForHash().get(RedisKey.PLAN_LISTEN_INFO,code);
|
|
|
+ if (planCache == null){
|
|
|
+ throw new BaseException("未获取到计划信息");
|
|
|
+ }
|
|
|
+ ListeningPlanNew planInfo = com.alibaba.fastjson.JSONObject.parseObject(planCache.toString(),ListeningPlanNew.class);
|
|
|
+// 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())));
|
|
|
+
|
|
|
+ Mono<DomainSelectRes> domainSelectResMono1 = template.select(Query.query(Criteria.where("group_type_id").is(planInfo.groupId())
|
|
|
.and("status").is(1).and("type").is(type).and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
.onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fm -> {
|
|
|
@@ -186,7 +199,7 @@ public class PlanNewOutController {
|
|
|
domainSelectRes.setPath("");
|
|
|
domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
return Mono.just(domainSelectRes);
|
|
|
- }));
|
|
|
+ });
|
|
|
return RStatus.success(domainSelectResMono1);
|
|
|
}
|
|
|
throw new BaseException("typePlan 类型错误");
|