GithubHelp home page GithubHelp logo

Comments (10)

zhanxuewei avatar zhanxuewei commented on June 2, 2024
    @GlobalTransactional
    @Override
    public void stockChange(List<StockDTO> stockDTOList, Boolean flag) {
        List<StockEntity> list = new ArrayList<>();
        for (StockDTO stockDTO : stockDTOList) {
            LambdaQueryWrapper<StockEntity> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(StockEntity::getProductId, stockDTO.getProductId());
            StockEntity stockEntity = super.getOne(wrapper);
            if (Objects.isNull(stockEntity)) {
                throw new BizException(ResultCode.PRODUCT_NOT_FOUND);
            }
            Integer stock = stockEntity.getStock();
            Integer resultStock = flag ? stock + stockDTO.getNumber() : stock - stockDTO.getNumber();
            stockEntity.setStock(resultStock);
            list.add(stockEntity);
        }
        if (CollUtil.isNotEmpty(list)) {
            super.saveOrUpdateBatch(list);
        }

        throw new BizException(ResultCode.FILE_SIZE_TOO_BIG_ERROR);

    }

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024
    @ResponseStatus(HttpStatus.OK)
    @ExceptionHandler(value = Exception.class)
    public ApiResult handleException(Exception exception) {
        return ApiResult.failed(ResultCode.FAILED.getCode(), exception.getCause().getMessage());
    }

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024
    @ResponseStatus(HttpStatus.OK)
    @ExceptionHandler(BizException.class)
    public ApiResult handleRRException(BizException exception) {
        return ApiResult.failed(exception.getCode(), exception.getMessage());
    }
// 这里的BizException被handleException(Excetion)捕获了

from incubator-seata.

funky-eyes avatar funky-eyes commented on June 2, 2024

Only 2.0 is a runtimeException, check for dependency conflicts

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024

from incubator-seata.

XieYingFa avatar XieYingFa commented on June 2, 2024

@funky-eyes 下一个版本会修复此问题么

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024
        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
            <version>2.2.6.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>io.seata</groupId>
                    <artifactId>seata-spring-boot-starter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024
seata:
  enabled: true
  application-id: ${spring.application.name}
  tx-service-group: my_test_tx_group
  enable-auto-data-source-proxy: true
  use-jdk-proxy: false
  #excludes-for-auto-proxying: firstClassNameForExclude,secondClassNameForExclude
  client:
    rm:
      async-commit-buffer-limit: 1000
      report-retry-count: 5
      table-meta-check-enable: false
      report-success-enable: false
      saga-branch-register-enable: false
      lock:
        retry-interval: 10
        retry-times: 30
        retry-policy-branch-rollback-on-conflict: true
    tm:
      degrade-check: false
      degrade-check-period: 2000
      degrade-check-allow-times: 10
      commit-retry-count: 5
      rollback-retry-count: 5
    undo:
      data-validation: true
      log-serialization: jackson
      log-table: undo_log
      only-care-update-columns: true
    log:
      exceptionRate: 100
  service:
    vgroup-mapping:
      my_test_tx_group: default
    grouplist:
      default: 127.0.0.1:8091
    enable-degrade: false
    disable-global-transaction: false
  transport:
    shutdown:
      wait: 3
    thread-factory:
      boss-thread-prefix: NettyBoss
      worker-thread-prefix: NettyServerNIOWorker
      server-executor-thread-prefix: NettyServerBizHandler
      share-boss-worker: false
      client-selector-thread-prefix: NettyClientSelector
      client-selector-thread-size: 1
      client-worker-thread-prefix: NettyClientWorkerThread
      worker-thread-size: default
      boss-thread-size: 1
    type: TCP
    server: NIO
    heartbeat: true
    serialization: seata
    compressor: none
    enable-client-batch-send-request: true
  config:
    type: nacos
    nacos:
      namespace: "dev"
      serverAddr: xxxxxxxx:8848
      group: SEATA_GROUP
      username: "nacos"
      password: "xxxxxxxx"
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: xxxxxx:8848
      group : "SEATA_GROUP"
      namespace: "dev"
      username: "nacos"
      password: "xxx"

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024

已经解决了,刚才仔细看了下官网版本对照信息:地址,发现是我seata依赖的版本不对。

        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
<!--            <version>2.0.0</version>-->
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
            <version>2.2.6.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>io.seata</groupId>
                    <artifactId>seata-spring-boot-starter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

from incubator-seata.

zhanxuewei avatar zhanxuewei commented on June 2, 2024

springboot version: 2.3.12.RELEASE --> 2.3.2.RELEASE
seata version: 2.00 ---> 1.3.0

from incubator-seata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.