|
@@ -114,8 +114,7 @@ public class PlanNewOutController {
|
|
|
* @return {@link Mono}<{@link RStatus}<{@link DomainSelectRes}>>
|
|
* @return {@link Mono}<{@link RStatus}<{@link DomainSelectRes}>>
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("domain/select")
|
|
@GetMapping("domain/select")
|
|
|
-
|
|
|
|
|
- public Mono<RStatus<DomainSelectRes>> domainSelect(@RequestParam("code") String code,@RequestParam("type") String type ,@RequestParam("typePlan") Integer typePlan ){
|
|
|
|
|
|
|
+ public Mono<RStatus<DomainSelectRes>> domainSelect(@RequestParam("code") String code,@RequestParam("type") String type ,@RequestParam("typePlan") Integer typePlan , ServerWebExchange exchange ){
|
|
|
if (1 == typePlan) {
|
|
if (1 == typePlan) {
|
|
|
Mono<PlanNew> code1 = template
|
|
Mono<PlanNew> code1 = template
|
|
|
.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
|
|
.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
|
|
@@ -192,33 +191,54 @@ public class PlanNewOutController {
|
|
|
return Mono.just(domainSelectRes);
|
|
return Mono.just(domainSelectRes);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- return RStatus.success(domainSelectResMono1);
|
|
|
|
|
|
|
+ Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
|
|
+ return rateReturn.flatMap(bl->{
|
|
|
|
|
+ if(bl){
|
|
|
|
|
+ return RStatus.successList(domainSelectResMono1) ;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ DomainSelectRes dataLists = new DomainSelectRes();
|
|
|
|
|
+ dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
|
|
+ return RStatus.fail("1","",Mono.just(dataLists));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // return RStatus.success(domainSelectResMono1);
|
|
|
}else if(2==typePlan){
|
|
}else if(2==typePlan){
|
|
|
- Long start = System.currentTimeMillis();
|
|
|
|
|
- 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);
|
|
|
|
|
- String idKey = RedisKey.DOMAIN_RAND_ID + planInfo.groupId().toString() + ":" + type.toString();
|
|
|
|
|
- String domainId = stringRedisTemplate.opsForSet().randomMember(idKey);
|
|
|
|
|
- if (domainId.isEmpty()){
|
|
|
|
|
- throw new BaseException("缓存"+ idKey + "不存在");
|
|
|
|
|
- }
|
|
|
|
|
- Object domainInfoCache = stringRedisTemplate.opsForHash().get(RedisKey.DOMAIN_INFO,domainId);
|
|
|
|
|
- if (domainInfoCache == null){
|
|
|
|
|
- throw new BaseException("缓存" + RedisKey.DOMAIN_INFO + "指定域名信息不存在");
|
|
|
|
|
- }
|
|
|
|
|
- DomainSelect domainInfo = com.alibaba.fastjson.JSONObject.parseObject(domainInfoCache.toString(),DomainSelect.class);
|
|
|
|
|
- DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
|
|
- String domain = domainInfo.domain();
|
|
|
|
|
- String string = RandomStr.getRandomStr(code);
|
|
|
|
|
- domainSelectRes.setDomain(string+"."+domain);
|
|
|
|
|
- domainSelectRes.setPath("");
|
|
|
|
|
- domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
|
|
- Long end = System.currentTimeMillis();
|
|
|
|
|
- log.info("volta-time:{}-{}-{}",start,end,start-end);
|
|
|
|
|
- return RStatus.success(Mono.just(domainSelectRes));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
|
|
+ return rateReturn.flatMap(bl->{
|
|
|
|
|
+ if(bl){
|
|
|
|
|
+ Long start = System.currentTimeMillis();
|
|
|
|
|
+ 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);
|
|
|
|
|
+ String idKey = RedisKey.DOMAIN_RAND_ID + planInfo.groupId().toString() + ":" + type.toString();
|
|
|
|
|
+ String domainId = stringRedisTemplate.opsForSet().randomMember(idKey);
|
|
|
|
|
+ if (domainId.isEmpty()){
|
|
|
|
|
+ throw new BaseException("缓存"+ idKey + "不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ Object domainInfoCache = stringRedisTemplate.opsForHash().get(RedisKey.DOMAIN_INFO,domainId);
|
|
|
|
|
+ if (domainInfoCache == null){
|
|
|
|
|
+ throw new BaseException("缓存" + RedisKey.DOMAIN_INFO + "指定域名信息不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ DomainSelect domainInfo = com.alibaba.fastjson.JSONObject.parseObject(domainInfoCache.toString(),DomainSelect.class);
|
|
|
|
|
+ DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
|
|
+ String domain = domainInfo.domain();
|
|
|
|
|
+ String string = RandomStr.getRandomStr(code);
|
|
|
|
|
+ domainSelectRes.setDomain(string+"."+domain);
|
|
|
|
|
+ domainSelectRes.setPath("");
|
|
|
|
|
+ domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
|
|
+ Long end = System.currentTimeMillis();
|
|
|
|
|
+ log.info("volta-time:{}-{}-{}",start,end,start-end);
|
|
|
|
|
+ return RStatus.successList(Mono.just(domainSelectRes)) ;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ DomainSelectRes dataLists = new DomainSelectRes();
|
|
|
|
|
+ dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
|
|
+ return RStatus.fail("1","",Mono.just(dataLists));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // return RStatus.success(Mono.just(domainSelectRes));
|
|
|
}
|
|
}
|
|
|
throw new BaseException("typePlan 类型错误");
|
|
throw new BaseException("typePlan 类型错误");
|
|
|
|
|
|
|
@@ -579,17 +599,8 @@ public class PlanNewOutController {
|
|
|
});
|
|
});
|
|
|
return dataListsMono;
|
|
return dataListsMono;
|
|
|
});
|
|
});
|
|
|
- Mono<Boolean> rateReturn = blacklistService.getRateReturn(exchange);
|
|
|
|
|
- return rateReturn.flatMap(bl->{
|
|
|
|
|
- if(bl){
|
|
|
|
|
- return RStatus.successList(dataListsMono1) ;
|
|
|
|
|
- }else {
|
|
|
|
|
- DataLists dataLists = new DataLists();
|
|
|
|
|
- dataLists.setWxUrl(BlacklistService.wxUrl.get());
|
|
|
|
|
- return RStatus.fail("1","",Mono.just(dataLists));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- // return RStatus.successList(dataListsMono1);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return RStatus.successList(dataListsMono1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|