Helius
2021-06-25 d7064002eea6b2bc49e1a4f74f8b6b45d91f0026
gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java
@@ -160,6 +160,17 @@
        if (goods == null || ScoreGoods.ISSALE_NO.equals(goods.getIsSale())) {
            throw new RestException(-3, "商品不存在或已下架");
        }
        if (ScoreGoods.ISQG_YES.equals(goods.getIsQg())) {
            if (new Date().before(goods.getQgStartTime())) {
                throw new RestException(-3, "抢购未开始");
            }
            if (new Date().after(goods.getQgEndTime())) {
                throw new RestException(-3, "抢购已结束");
            }
        }
        AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(addGoodsOrderDto.getUserId());
        if (accountInfo.getCollectScore() == null) {
@@ -215,11 +226,9 @@
        expressInfo.setCreatedTime(new Date());
        scoreExpressInfoMapper.insert(expressInfo);
        AccountInfo update = new AccountInfo();
        update.setAccountId(accountInfo.getAccountId());
        BigDecimal remianScore = score.subtract(totalPrice);
        update.setCollectScore(remianScore.toString());
        accountInfoMapper.updateByPrimaryKey(update);
        BigDecimal remianScore = score.subtract(totalPrice).setScale(0, BigDecimal.ROUND_DOWN);
        accountInfo.setCollectScore(remianScore.toString());
        accountInfoMapper.updateByPrimaryKey(accountInfo);
        ScoreDetails scoreDetails = new ScoreDetails();
        scoreDetails.setOrderNo(order.getOrderNo());