public Mono<GroupsCountDMO> saveOrUpdateGroupsCount(GroupsCountDMO groupsCountDMO) {
        log.info("groupsCountDMO:{}", groupsCountDMO);
        return groupsCountRepository.findByChatIdAndAndWhichDay(groupsCountDMO.getChatId(), groupsCountDMO.getWhichDay())
                .switchIfEmpty(
                        groupsCountRepository.save(groupsCountDMO.setAsNew())
                )
                .doOnSuccess(find -> log.info("findByChatIdAndAndWhichDay:{}", find))
                .publishOn(Schedulers.boundedElastic())
                .doOnError(e -> log.error("saveOrUpdateGroupsCount error:{}", e))
                .flatMap(countEntity -> {
                            groupsCountDMO.setNewGroupsCount(false);
                            groupsCountDMO.setId(countEntity.getId());
                            return groupsCountRepository.updateAllCount(
                                    groupsCountDMO.getChatId(),
                                    groupsCountDMO.getWhichDay(),
                                    groupsCountDMO.getUserAllCount());
                        }
                )
                .onErrorResume(
                        err -> {
                            log.error("GroupsCountDao saveGroupAllCount error :{}", err);
                            return Mono.error(err);
                        }
                );
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2021-04-28
  • 2021-12-24
  • 2021-08-01
  • 2021-09-08
相关资源
相似解决方案