|
|
@@ -93,9 +93,9 @@ 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);
|
|
|
// //类型 1素材分类2清水分类
|
|
|
- Mono<List<Domain>> domain = code.flatMap(plan -> template.select(Query.query(Criteria.where("group_type").is(1)), Domain.class).collectList());
|
|
|
- Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(1)), Image.class).collectList();
|
|
|
- Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(4)), Material.class).collectList();
|
|
|
+ Mono<List<Domain>> domain = code.flatMap(plan -> template.select(Query.query(Criteria.where("group_type").is(1).and("deleted_at").isNull()), Domain.class).collectList());
|
|
|
+ Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Image.class).collectList();
|
|
|
+ Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(4).and("deleted_at").isNull()), Material.class).collectList();
|
|
|
Mono<List<H5ImageAndText>> arrayListMono = Mono.zip(code, domain, image, text).flatMap(f -> {
|
|
|
//H5ImageAndText
|
|
|
Integer integer = f.getT1().pageShow();//群数量
|
|
|
@@ -148,19 +148,25 @@ public class PlanNewOutController {
|
|
|
Mono<PlanNew> code0 = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class);
|
|
|
Mono<DataLists> dataListsMono1 = code0.flatMap(planNew -> {
|
|
|
Mono<PlanNew> code = Mono.just(planNew);
|
|
|
- Mono<List<Domain>> domain = code.flatMap(plan -> template.select(Query.query(Criteria.where("group_type").is(1)), Domain.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"6"))).collectList());
|
|
|
+ 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());
|
|
|
// //类型 1素材分类2清水分类
|
|
|
- Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(1)), Image.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"7"))).collectList();
|
|
|
- Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(4)), Material.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"8"))).collectList();
|
|
|
+ Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Image.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"7"))).collectList();
|
|
|
+ Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(4).and("deleted_at").isNull()), Material.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"8"))).collectList();
|
|
|
Mono<UserVisits> insert = template.insert(new UserVisits(null, request.getWx_user_id(), 1));
|
|
|
- Mono<UserVisits> 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")))
|
|
|
- .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")));
|
|
|
- }
|
|
|
- }).switchIfEmpty(insert);
|
|
|
+ Mono<UserVisits> wx_user_id ;
|
|
|
+ if (Objects.isNull(request.getWx_user_id()) || "".equals(request.getWx_user_id())) {
|
|
|
+ wx_user_id=Mono.just(new UserVisits(null,null,null));
|
|
|
+ }else{
|
|
|
+ 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")))
|
|
|
+ .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")));
|
|
|
+ }
|
|
|
+ }).switchIfEmpty(insert);
|
|
|
+ }
|
|
|
+
|
|
|
Mono<List<H5ImageAndText>> arrayListMono = Mono.zip(code, domain, image, text).flatMap(f -> {
|
|
|
//H5ImageAndText
|
|
|
Integer integer = f.getT1().pageShow();//群数量
|
|
|
@@ -187,21 +193,21 @@ public class PlanNewOutController {
|
|
|
return Mono.just(new Audio(null,null,null,null,null,null,null,null));
|
|
|
}else {
|
|
|
return template.selectOne(
|
|
|
- Query.query(Criteria.where("id").is(plan.listAudioId())),
|
|
|
+ Query.query(Criteria.where("id").is(plan.listAudioId()).and("deleted_at").isNull()),
|
|
|
Audio.class);
|
|
|
} }
|
|
|
).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"1")));
|
|
|
Mono<Audio> retAudioId = code.flatMap(plan -> template.selectOne(Query.query(Criteria.where("id")
|
|
|
- .is(plan.retAudioId())), 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 Exception(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())), 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 Exception(throwable.getMessage()+"3")));
|
|
|
}
|
|
|
}).switchIfEmpty(Mono.just(getReturnLoop()));
|
|
|
- Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1)), 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)), 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 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<DataLists> dataListsMono = Mono.zip(code, listAudio, retAudioId, returnLoop, arrayListMono, adtop, bottom, wx_user_id).flatMap(f -> {
|
|
|
DataLists dataLists = new DataLists();
|
|
|
dataLists.setPlanNew(f.getT1());
|
|
|
@@ -213,7 +219,8 @@ public class PlanNewOutController {
|
|
|
dataLists.setReturnLoop(null);
|
|
|
}
|
|
|
dataLists.setImages(f.getT5());
|
|
|
- if (f.getT8().num() >= 4) {
|
|
|
+
|
|
|
+ if (f.getT8().num() >= 4 && Objects.nonNull(request.getWx_user_id()) && !"".equals(request.getWx_user_id())) {
|
|
|
dataLists.setIsRet(1);
|
|
|
} else {
|
|
|
dataLists.setIsRet(-1);
|
|
|
@@ -410,12 +417,12 @@ public class PlanNewOutController {
|
|
|
if (Objects.nonNull(request.getWx_user_id()) && !"".equals(request.getWx_user_id())) {
|
|
|
PlanNewBackgroupPoster qsSetting = f.getQsSetting();
|
|
|
if (Objects.nonNull(qsSetting) && Objects.nonNull(qsSetting.audioId()) && 0 != qsSetting.audioId()) {
|
|
|
- id = template.selectOne(Query.query(Criteria.where("id").is(qsSetting.audioId())), Audio.class);
|
|
|
+ id = template.selectOne(Query.query(Criteria.where("id").is(qsSetting.audioId()).and("deleted_at").isNull()), Audio.class);
|
|
|
}
|
|
|
} else {
|
|
|
PlanNewBackgroupPoster fxSetting = f.getFxSetting();
|
|
|
if (Objects.nonNull(fxSetting) && Objects.nonNull(fxSetting.audioId()) && 0 != fxSetting.audioId()) {
|
|
|
- id = template.selectOne(Query.query(Criteria.where("id").is(fxSetting.audioId())), Audio.class);
|
|
|
+ id = template.selectOne(Query.query(Criteria.where("id").is(fxSetting.audioId()).and("deleted_at").isNull()), Audio.class);
|
|
|
}
|
|
|
}
|
|
|
if (Objects.isNull(id)) {
|