|
@@ -3,12 +3,15 @@ package com.webflux.launchadmin.mysql.service.otherServices;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.webflux.launchadmin.global.BaseException;
|
|
import com.webflux.launchadmin.global.BaseException;
|
|
|
import com.webflux.launchadmin.mysql.controller.otherServices.res.ByCodeGetImportDomainRes;
|
|
import com.webflux.launchadmin.mysql.controller.otherServices.res.ByCodeGetImportDomainRes;
|
|
|
import com.webflux.launchadmin.mysql.controller.planNew.res.PlanNewAllRs;
|
|
import com.webflux.launchadmin.mysql.controller.planNew.res.PlanNewAllRs;
|
|
|
import com.webflux.launchadmin.mysql.entity.listening.ListeningPlanNew;
|
|
import com.webflux.launchadmin.mysql.entity.listening.ListeningPlanNew;
|
|
|
import com.webflux.launchadmin.mysql.entity.planNew.DomainSelect;
|
|
import com.webflux.launchadmin.mysql.entity.planNew.DomainSelect;
|
|
|
import com.webflux.launchadmin.mysql.entity.planNew.PlanNew;
|
|
import com.webflux.launchadmin.mysql.entity.planNew.PlanNew;
|
|
|
|
|
+import com.webflux.launchadmin.mysql.entity.planNew.PlanNewCommon;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
@@ -42,24 +45,76 @@ public class OtherServicesImpl implements OtherServicesInterface {
|
|
|
.format("通过code:{}查询是否听书计划异常:::{}",
|
|
.format("通过code:{}查询是否听书计划异常:::{}",
|
|
|
code,
|
|
code,
|
|
|
throwable.getMessage()))));
|
|
throwable.getMessage()))));
|
|
|
|
|
+
|
|
|
|
|
+ Mono<Long> common = template
|
|
|
|
|
+ .count(query, PlanNewCommon.class)
|
|
|
|
|
+ .onErrorResume(throwable ->
|
|
|
|
|
+ Mono.error(new Exception(StrUtil
|
|
|
|
|
+ .format("通过code:{}查询计划异常:::{}",
|
|
|
|
|
+ code,
|
|
|
|
|
+ throwable.getMessage()))));
|
|
|
Mono<ByCodeGetImportDomainRes> stringBuilderMono1 = Mono
|
|
Mono<ByCodeGetImportDomainRes> stringBuilderMono1 = Mono
|
|
|
- .zip(planNew, listeningPlan)
|
|
|
|
|
|
|
+ .zip(planNew, listeningPlan,common)
|
|
|
.flatMap(f -> {
|
|
.flatMap(f -> {
|
|
|
Long t1 = f.getT1();
|
|
Long t1 = f.getT1();
|
|
|
Long t2 = f.getT2();
|
|
Long t2 = f.getT2();
|
|
|
- Mono<ByCodeGetImportDomainRes> stringBuilderMono;
|
|
|
|
|
|
|
+ Long t3 = f.getT3();
|
|
|
|
|
+ Mono<ByCodeGetImportDomainRes> stringBuilderMono;
|
|
|
if (t1 > 0) {
|
|
if (t1 > 0) {
|
|
|
stringBuilderMono = getNewPlan(code, query);
|
|
stringBuilderMono = getNewPlan(code, query);
|
|
|
} else if (t2 > 0) {
|
|
} else if (t2 > 0) {
|
|
|
stringBuilderMono = getNewListeningNewPlan(code, query);
|
|
stringBuilderMono = getNewListeningNewPlan(code, query);
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if(t3>0){
|
|
|
|
|
+ stringBuilderMono = getNewPlanCommon(code, query);
|
|
|
|
|
+ }else {
|
|
|
throw new BaseException("code不存在");
|
|
throw new BaseException("code不存在");
|
|
|
}
|
|
}
|
|
|
return stringBuilderMono;
|
|
return stringBuilderMono;
|
|
|
});
|
|
});
|
|
|
return RStatus.success(stringBuilderMono1);
|
|
return RStatus.success(stringBuilderMono1);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ private Mono<ByCodeGetImportDomainRes> getNewPlanCommon(String code, Query query) {
|
|
|
|
|
+ return template.selectOne(query, PlanNewCommon.class)
|
|
|
|
|
+ .switchIfEmpty(Mono
|
|
|
|
|
+ .error(new BaseException(StrUtil
|
|
|
|
|
+ .format("通过code:{}查询common计划异常:::{}",
|
|
|
|
|
+ code,
|
|
|
|
|
+ "返回结构为空"))))
|
|
|
|
|
+ .onErrorResume(throwable ->
|
|
|
|
|
+ Mono.error(new BaseException(StrUtil
|
|
|
|
|
+ .format("通过code:{}查询common计划异常:::{}",
|
|
|
|
|
+ code,
|
|
|
|
|
+ throwable.getMessage()))))
|
|
|
|
|
+ .flatMap(ff -> {
|
|
|
|
|
+ Long groupId = ff.groupId();
|
|
|
|
|
+ if (Objects.isNull(groupId)) {
|
|
|
|
|
+ return Mono.error(new BaseException("查询common计划 groupId 值为 null"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(Objects.nonNull(ff.type()) && 5==ff.type()){
|
|
|
|
|
+ String configJson = ff.configJson();
|
|
|
|
|
+ if(Objects.nonNull(configJson) ){
|
|
|
|
|
+ JSONObject jsonObject;
|
|
|
|
|
+ try {
|
|
|
|
|
+ jsonObject = JSONUtil.parseObj(configJson);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new BaseException("解析configJson异常"+e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!jsonObject.containsKey("posterCustomerServiceId")){
|
|
|
|
|
+ throw new BaseException("解析configJson 不包含字段 posterCustomerServiceId");
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ groupId = jsonObject.get("posterCustomerServiceId", Long.class);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new BaseException("解析posterCustomerServiceId异常"+e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // String s = byCustomerIdGetUrl(posterCustomerServiceId);
|
|
|
|
|
+ //return Mono.just(new StringBuilder(s));
|
|
|
|
|
+ }
|
|
|
|
|
+ //saveRequest.setImportDomain(String.valueOf(saveRequest.getGroupId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ return getDomainSetV(groupId, code);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
private Mono<ByCodeGetImportDomainRes> getNewListeningNewPlan(String code, Query query) {
|
|
private Mono<ByCodeGetImportDomainRes> getNewListeningNewPlan(String code, Query query) {
|
|
|
return template.selectOne(query, ListeningPlanNew.class)
|
|
return template.selectOne(query, ListeningPlanNew.class)
|
|
|
.switchIfEmpty(Mono
|
|
.switchIfEmpty(Mono
|