|
@@ -24,6 +24,8 @@ import com.webflux.launchadmin.mysql.service.planNew.PlanServiceInterface;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.goGenerate.GoGenerateService;
|
|
import com.webflux.launchadmin.mysql.service.planNew.goGenerate.GoGenerateService;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
|
|
|
+import com.webflux.launchadmin.mysql.task.SyncListeningAudioToRedis;
|
|
|
|
|
+import com.webflux.launchadmin.mysql.task.SyncPlanNewListenToRedis;
|
|
|
import com.webflux.launchcommon.returnObj.Paged;
|
|
import com.webflux.launchcommon.returnObj.Paged;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
@@ -55,6 +57,10 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
|
|
|
private R2dbcEntityTemplate template;
|
|
private R2dbcEntityTemplate template;
|
|
|
@Resource
|
|
@Resource
|
|
|
private PlanServiceInterface planServiceInterface;
|
|
private PlanServiceInterface planServiceInterface;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private SyncListeningAudioToRedis syncListeningAudioToRedis;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private SyncPlanNewListenToRedis syncPlanNewListenToRedis;
|
|
|
@Override
|
|
@Override
|
|
|
public Mono<RStatus<Paged<ListeningPlanNewRes2>>> page(PlanReqPage request, Criteria criteria) {
|
|
public Mono<RStatus<Paged<ListeningPlanNewRes2>>> page(PlanReqPage request, Criteria criteria) {
|
|
|
Query query = Query.query(criteria);
|
|
Query query = Query.query(criteria);
|
|
@@ -273,7 +279,11 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
|
|
|
} else {
|
|
} else {
|
|
|
updateOrinsert = template.insert(listeningAudio);
|
|
updateOrinsert = template.insert(listeningAudio);
|
|
|
}
|
|
}
|
|
|
- return RStatus.success(updateOrinsert);
|
|
|
|
|
|
|
+ Mono<ListeningAudio> listeningAudioMono = updateOrinsert.flatMap(fm -> {
|
|
|
|
|
+ syncListeningAudioToRedis.setRedisValue(fm).subscribe();
|
|
|
|
|
+ return Mono.just(fm);
|
|
|
|
|
+ });
|
|
|
|
|
+ return RStatus.success(listeningAudioMono);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -383,14 +393,18 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Mono<RStatus<ListeningDataLists>> LandingPageList(OutListeningRequest outListeningRequest) {
|
|
public Mono<RStatus<ListeningDataLists>> LandingPageList(OutListeningRequest outListeningRequest) {
|
|
|
- Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code")
|
|
|
|
|
- .is(outListeningRequest.getCode())), ListeningPlanNew.class)
|
|
|
|
|
|
|
+// Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code")
|
|
|
|
|
+// .is(outListeningRequest.getCode())), ListeningPlanNew.class)
|
|
|
|
|
+// .switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
|
|
+// .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
|
|
|
+ Mono<ListeningPlanNew> code1 = syncPlanNewListenToRedis.byRedisGetPlanNewIfErByMysql(outListeningRequest.getCode())
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
|
Mono<ListeningDataLists> idx_num1 = code1.flatMap(f -> {
|
|
Mono<ListeningDataLists> idx_num1 = code1.flatMap(f -> {
|
|
|
- Mono<List<ListeningAudio>> idx_num = template.select(Query.query(Criteria.empty())
|
|
|
|
|
- .sort(Sort.by(Sort.Order.asc("idx_num")))
|
|
|
|
|
- .limit(f.pageShow()), ListeningAudio.class).collectList();
|
|
|
|
|
|
|
+ Mono<List<ListeningAudio>> idx_num =syncListeningAudioToRedis.byRedisGetLinteningAudioIfErByMysql(f.pageShow());
|
|
|
|
|
+// Mono<List<ListeningAudio>> idx_num = template.select(Query.query(Criteria.empty())
|
|
|
|
|
+// .sort(Sort.by(Sort.Order.asc("idx_num")))
|
|
|
|
|
+// .limit(f.pageShow()), ListeningAudio.class).collectList();
|
|
|
return Mono.zip(Mono.just(f), idx_num).flatMap(ff -> {
|
|
return Mono.zip(Mono.just(f), idx_num).flatMap(ff -> {
|
|
|
ListeningDataLists listeningDataLists = new ListeningDataLists();
|
|
ListeningDataLists listeningDataLists = new ListeningDataLists();
|
|
|
ListeningPlanNew t1 = ff.getT1();
|
|
ListeningPlanNew t1 = ff.getT1();
|
|
@@ -496,6 +510,21 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
|
|
|
return RStatus.success(dataListsShareMono);
|
|
return RStatus.success(dataListsShareMono);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Mono<RStatus<Long>> deleteAudioById(Long newAudioId) {
|
|
|
|
|
+ Query new_audio_id = Query.query(Criteria.where("new_audio_id")
|
|
|
|
|
+ .is(newAudioId));
|
|
|
|
|
+ Mono<ListeningAudio> listeningAudioMono = template.selectOne(new_audio_id, ListeningAudio.class)
|
|
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("待删除的数据不存在 请刷新页面")))
|
|
|
|
|
+ .flatMap(fm -> template.delete(fm));
|
|
|
|
|
+ Mono<Long> longMono = listeningAudioMono.flatMap(f -> {
|
|
|
|
|
+ syncListeningAudioToRedis.deleteRedis(f).subscribe();
|
|
|
|
|
+ return Mono.just(f.newAudioId());
|
|
|
|
|
+ });
|
|
|
|
|
+ return RStatus.success(longMono);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void setQrcodeV(reactor.util.function.Tuple5<ListeningPlanNew, PosterTemplate, List<Poster>, List<ListeningPlanNewBackgroupPoster>, StringBuilder> f, GoRequest goRequest, ListeningPlanNewBackgroupPoster fxSetting) {
|
|
private void setQrcodeV(reactor.util.function.Tuple5<ListeningPlanNew, PosterTemplate, List<Poster>, List<ListeningPlanNewBackgroupPoster>, StringBuilder> f, GoRequest goRequest, ListeningPlanNewBackgroupPoster fxSetting) {
|
|
|
if (Objects.nonNull(fxSetting)) {
|
|
if (Objects.nonNull(fxSetting)) {
|
|
|
Optional<Item> first = goRequest.getItem().stream().filter(fz -> "qrcode".equals(fz.getT())).findFirst();
|
|
Optional<Item> first = goRequest.getItem().stream().filter(fz -> "qrcode".equals(fz.getT())).findFirst();
|