Skip to content

Commit

Permalink
适配2.17.0版本
Browse files Browse the repository at this point in the history
  • Loading branch information
chengzhongxue committed Jun 29, 2024
1 parent 0d72032 commit e0e7d21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
35 changes: 16 additions & 19 deletions src/main/java/la/moony/douban/service/impl/DoubanServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void addDouban(String DOUBAN_ID){
var listOptions = new ListOptions();
var query = and(equal("spec.type", type1),equal("spec.id", id));
listOptions.setFieldSelector(FieldSelector.of(query));
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, null);
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, Sort.by("faves.createTime"));
Mono<Boolean> booleanMono = list.hasElements();
Date finalDate = date;
String finalScore = score;
Expand All @@ -140,21 +140,19 @@ public void addDouban(String DOUBAN_ID){
Date finalDate1 = date;
booleanMono.flatMap(hasValue -> {
if (hasValue) {
list.next()
.flatMap(doubanMovie -> {
if(StringUtils.isNotEmpty(doubanMovie.getFaves().getStatus())){
if (doubanMovie.getFaves().getStatus().equals(status1)){
confition.set(false);
return Mono.empty();
}
return list.next().flatMap(doubanMovie -> {
if (StringUtils.isNotEmpty(doubanMovie.getFaves().getStatus())) {
if (doubanMovie.getFaves().getStatus().equals(status1)) {
confition.set(false);
return Mono.empty();
}
doubanMovie.getFaves().setCreateTime(finalDate.toInstant());
doubanMovie.getFaves().setRemark(remark);
doubanMovie.getFaves().setScore(finalScore);
doubanMovie.getFaves().setStatus(status1);
reactiveClient.update(doubanMovie).subscribe();
return Mono.empty();
}).subscribe();
}
doubanMovie.getFaves().setCreateTime(finalDate.toInstant());
doubanMovie.getFaves().setRemark(remark);
doubanMovie.getFaves().setScore(finalScore);
doubanMovie.getFaves().setStatus(status1);
return reactiveClient.update(doubanMovie);
});
} else {
DoubanMovie doubanMovie = new DoubanMovie();
doubanMovie.setMetadata(new Metadata());
Expand All @@ -176,9 +174,8 @@ public void addDouban(String DOUBAN_ID){
doubanMovie.getFaves().setRemark(remark);
doubanMovie.getFaves().setScore(score);
doubanMovie.getFaves().setStatus(status1);
reactiveClient.create(doubanMovie).subscribe();
return reactiveClient.create(doubanMovie);
}
return Mono.empty();
}).subscribe();
}
i.set(i.get()+1);
Expand Down Expand Up @@ -290,7 +287,7 @@ public Mono<DoubanMovieVo> tmdbDetail(String type,String id,String apiKey){
var listOptions = new ListOptions();
var query = and(equal("spec.type", type),equal("spec.id", id),equal("spec.dataType", "tmdb"));
listOptions.setFieldSelector(FieldSelector.of(query));
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, null);
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, Sort.by("faves.createTime"));
Mono<Boolean> booleanMono = list.hasElements();
return booleanMono.flatMap(hasValue ->{
if (hasValue){
Expand Down Expand Up @@ -347,7 +344,7 @@ public Mono<DoubanMovieVo> doubanDetail(String type,String id){
var listOptions = new ListOptions();
var query = and(equal("spec.type", type),equal("spec.id", id));
listOptions.setFieldSelector(FieldSelector.of(query));
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, null);
Flux<DoubanMovie> list = reactiveClient.listAll(DoubanMovie.class, listOptions, Sort.by("faves.createTime"));
Mono<Boolean> booleanMono = list.hasElements();
return this.settingFetcher.get("base").flatMap(base ->booleanMono
.flatMap(hasValue ->{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: plugin-douban
spec:
enabled: true
requires: ">=2.14.0"
requires: ">=2.15.0"
author:
name: 困困鱼
website: https://github.com/chengzhongxue
Expand Down

0 comments on commit e0e7d21

Please sign in to comment.