|
|
@@ -1,6 +1,7 @@
|
|
|
package com.webflux.launchadmin.mysql.controller.planNew;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.webflux.launchadmin.config.BaseContextHandler;
|
|
|
@@ -58,6 +59,29 @@ public class PlanNewController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
+ *通过 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);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *
|
|
|
* 分享、清水背景组-回显
|
|
|
* @param planNewId 计划id
|
|
|
* @param qsOrFx 1:分享 2:清水
|