|
|
@@ -104,7 +104,7 @@ public class PlanNewOutController {
|
|
|
Mono<PlanNew> code1 = template
|
|
|
.selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception( throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException( throwable.getMessage())));
|
|
|
Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> {
|
|
|
Mono<String> stringMono;
|
|
|
if (f.transferPageBl() == 1 && Objects.nonNull(f.transferPageDomain())) {
|
|
|
@@ -114,7 +114,7 @@ public class PlanNewOutController {
|
|
|
.and("type").is(5)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.transferPageDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
@@ -136,7 +136,7 @@ public class PlanNewOutController {
|
|
|
.and("type").is(4)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查詢為空 group_type_id" + f.backgroupDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
@@ -152,7 +152,7 @@ public class PlanNewOutController {
|
|
|
Mono<String> stringMono2 = template.select(Query.query(Criteria.where("group_type_id").is(f.landingPageDomain())
|
|
|
.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 -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).collectList().flatMap(fm -> {
|
|
|
// DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
int i = RandomUtil.randomInt(0, fm.size());
|
|
|
String domain = fm.get(i).domain();
|
|
|
@@ -214,7 +214,7 @@ public class PlanNewOutController {
|
|
|
public Mono<RStatus<DataListsKefu>> kefuList(@RequestBody KefuRequest request){
|
|
|
Mono<PlanNew> code = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("code查询返回结构为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception("通过code查询计划异常::" + throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException("通过code查询计划异常::" + throwable.getMessage())));
|
|
|
Mono<DataListsKefu> dataListsKefuMono = code.flatMap(planNew -> {
|
|
|
Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(5)
|
|
|
.and("deleted_at").isNull()
|
|
|
@@ -222,13 +222,13 @@ public class PlanNewOutController {
|
|
|
.collectList()
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
- Mono.error(new Exception(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), throwable.getMessage()))));
|
|
|
+ Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), throwable.getMessage()))));
|
|
|
Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(11)
|
|
|
.and("group_type_id").is(planNew.groupId())
|
|
|
.and("deleted_at").isNull()), Material.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
- Mono.error(new Exception(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), throwable.getMessage()))))
|
|
|
+ Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), throwable.getMessage()))))
|
|
|
.collectList();
|
|
|
Mono<List<H5ImageAndText>> arrayListMono = Mono.zip(Mono.just(planNew), image, text).flatMap(f -> {
|
|
|
//H5ImageAndText
|
|
|
@@ -323,7 +323,7 @@ public class PlanNewOutController {
|
|
|
|
|
|
Mono<PlanNew> code0 = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
|
Mono<DataLists> dataListsMono1 = code0.flatMap(planNew -> {
|
|
|
Mono<PlanNew> code = Mono.just(planNew);
|
|
|
Long group_type_id ; //.and("group_type_id").is(group_type_id)
|
|
|
@@ -333,7 +333,7 @@ public class PlanNewOutController {
|
|
|
group_type_id=planNew.groupIdQs();
|
|
|
}
|
|
|
Mono<List<Domain>> domain = code.flatMap(plan -> template.select(Query.query(Criteria.where("group_type").is(1)
|
|
|
- .and("deleted_at").isNull()), Domain.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"6"))).collectList());
|
|
|
+ .and("deleted_at").isNull()), Domain.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"6"))).collectList());
|
|
|
// //类型 1素材分类2清水分类
|
|
|
Criteria criteria = Criteria.where("type")
|
|
|
.is(1).and("deleted_at").isNull()
|
|
|
@@ -345,11 +345,11 @@ public class PlanNewOutController {
|
|
|
}
|
|
|
Query query = Query.query(criteria);
|
|
|
Mono<List<Image>> image = template.select(query, Image.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"7")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"7")))
|
|
|
.collectList();
|
|
|
Mono<List<Material>> text = template.select(Query.query(Criteria.where("type")
|
|
|
.is(4).and("deleted_at").isNull().and("group_type_id").is(group_type_id)), Material.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"8")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"8")))
|
|
|
.collectList();
|
|
|
Mono<UserVisits> wx_user_id ;
|
|
|
if (Objects.isNull(request.getWx_user_id()) || "".equals(request.getWx_user_id())) {
|
|
|
@@ -357,13 +357,13 @@ public class PlanNewOutController {
|
|
|
}else{
|
|
|
Mono<UserVisits> insert = template.insert(new UserVisits(null, request.getWx_user_id(), 1));
|
|
|
wx_user_id = template.selectOne(Query.query(Criteria.where("wx_user_id").is(request.getWx_user_id())), UserVisits.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"9")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"9")))
|
|
|
.flatMap(f -> {
|
|
|
if (f.num() >= 4) {
|
|
|
return Mono.just(f);
|
|
|
} else {
|
|
|
return template.update(new UserVisits(f.id(), f.wxUserId(), f.num() + 1))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"10")));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"10")));
|
|
|
}
|
|
|
}).switchIfEmpty(insert);
|
|
|
}
|
|
|
@@ -426,18 +426,18 @@ public class PlanNewOutController {
|
|
|
Query.query(Criteria.where("id").is(plan.listAudioId()).and("deleted_at").isNull()),
|
|
|
Audio.class);
|
|
|
} }
|
|
|
- ).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"1")));
|
|
|
+ ).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"1")));
|
|
|
Mono<Audio> retAudioId = code.flatMap(plan -> template.selectOne(Query.query(Criteria.where("id")
|
|
|
- .is(plan.retAudioId()).and("deleted_at").isNull()), Audio.class)).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"2")));
|
|
|
+ .is(plan.retAudioId()).and("deleted_at").isNull()), Audio.class)).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"2")));
|
|
|
Mono<ReturnLoop> returnLoop = code.flatMap(plan -> {
|
|
|
if (Objects.isNull(plan.returnLoopId())) {
|
|
|
return Mono.just(getReturnLoop());
|
|
|
} else {
|
|
|
- return template.selectOne(Query.query(Criteria.where("id").is(plan.returnLoopId()).and("deleted_at").isNull()), ReturnLoop.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"3")));
|
|
|
+ return template.selectOne(Query.query(Criteria.where("id").is(plan.returnLoopId()).and("deleted_at").isNull()), ReturnLoop.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"3")));
|
|
|
}
|
|
|
}).switchIfEmpty(Mono.just(getReturnLoop()));
|
|
|
- Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"4"))).collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
- Mono<List<Ad>> bottom = template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"5"))).collectList();
|
|
|
+ Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"4"))).collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
|
|
|
+ Mono<List<Ad>> bottom = template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"5"))).collectList();
|
|
|
|
|
|
|
|
|
Mono<DataLists> dataListsMono = Mono.zip(code, listAudio, retAudioId, returnLoop, arrayListMono, adtop, bottom, wx_user_id).flatMap(f -> {
|
|
|
@@ -552,7 +552,7 @@ public class PlanNewOutController {
|
|
|
}
|
|
|
Mono<PlanNew> code0 = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
|
Mono<DataLists0> dataLists0Mono = code0.flatMap(ftmp->{
|
|
|
//(如果wx_user_id值不为空则使用清水分类)
|
|
|
Mono<StringBuilder> stringBuilderMono;
|
|
|
@@ -691,6 +691,7 @@ public class PlanNewOutController {
|
|
|
try {
|
|
|
jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
}catch (Exception e){
|
|
|
+ log.error(e.getMessage() +"---"+JSONUtil.parseObj(goRequest2), e);
|
|
|
throw new BaseException(e.getMessage() +"---"+JSONUtil.parseObj(goRequest2));
|
|
|
}
|
|
|
if (jsonObject1.containsKey("code")
|
|
|
@@ -730,6 +731,7 @@ public class PlanNewOutController {
|
|
|
try {
|
|
|
jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
}catch (Exception e){
|
|
|
+ log.error(e.getMessage() +"---"+posterTemplate, e);
|
|
|
throw new BaseException(e.getMessage() +"---"+posterTemplate);
|
|
|
}
|
|
|
//JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
@@ -831,6 +833,7 @@ public class PlanNewOutController {
|
|
|
try {
|
|
|
encodedParam = URLEncoder.encode(first3.get().getV(), StandardCharsets.UTF_8.toString());
|
|
|
}catch (Exception e){
|
|
|
+ log.error("URLEncoder Error"+e.getMessage(), e);
|
|
|
throw new BaseException("URLEncoder Error"+e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@@ -843,6 +846,7 @@ public class PlanNewOutController {
|
|
|
try {
|
|
|
jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
}catch (Exception e){
|
|
|
+ log.error(e.getMessage() +"---"+posterTemplate, e);
|
|
|
throw new BaseException(e.getMessage() +"---"+posterTemplate);
|
|
|
}
|
|
|
//JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
|