|
|
@@ -1,10 +1,13 @@
|
|
|
package com.webflux.launchadmin.mysql.controller.planNew;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
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.*;
|
|
|
import com.webflux.launchadmin.mysql.controller.planNew.res.*;
|
|
|
import com.webflux.launchadmin.mysql.entity.planNew.*;
|
|
|
@@ -53,7 +56,28 @@ public class PlanNewOutController {
|
|
|
map.clear();
|
|
|
log.info("清空计划-H5用户Map数据》》》》》》》》》》》》》》》》》》》》》》 结束");
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ *通过 code and type 查询 domain
|
|
|
+ * @param code
|
|
|
+ * @param type
|
|
|
+ * @return {@link Mono}<{@link RStatus}<{@link DomainSelectRes}>>
|
|
|
+ */
|
|
|
+ @GetMapping("domain/select")
|
|
|
+ public Mono<RStatus<DomainSelectRes>> domainSelect(@RequestParam("code") String code,@RequestParam("type") String type ){
|
|
|
+ Mono<PlanNew> code1 = template.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class);
|
|
|
+ Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria.where("group_type_id").is(f.groupId())
|
|
|
+ .and("status").is(1).and("type").is(type)), DomainSelect.class)
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fm -> {
|
|
|
+ DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
+ int i = RandomUtil.randomInt(0, fm.size());
|
|
|
+ domainSelectRes.setDomain(fm.get(i).domain());
|
|
|
+ domainSelectRes.setPath("");
|
|
|
+ domainSelectRes.setUnique(IdUtil.fastSimpleUUID());
|
|
|
+ return Mono.just(domainSelectRes);
|
|
|
+ }));
|
|
|
+ return RStatus.success(domainSelectResMono1);
|
|
|
+ }
|
|
|
/**
|
|
|
* 列表返回images(列表内容),shareQrurl(背景组) ,baiduDot,retAudio
|
|
|
* Mono<RStatus<DataListsKefu>>
|