zepengdev
2025-09-17 c06d972894b536cd96b817c922fb73f69c9d1a71
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
@@ -96,8 +96,6 @@
        }
        // 订单号
        String orderNum = redisUtils.generateSn(ORDER_KEY, GenerateEnum.ORDER.getKey());
        // 总金额
        BigDecimal amount = BigDecimal.ZERO;
        // 商品快照
        List<OrderProductSnapshot> snapshots = new ArrayList<>();
        for (ProductInfo productInfo : info.getProducts()) {
@@ -116,7 +114,6 @@
            snapshot.setOriginalPrice(product.getPrice());
            snapshot.setPaidPrice(product.getPrice());
            BigDecimal decimal = BigDecimalUtils.multiply(product.getPrice(), productInfo.getCount());
            amount = BigDecimalUtils.add(amount, decimal);
            snapshot.setActuallyPayPrice(decimal);
            snapshot.setPayState(PayStateEnum.NOTPAY.getKey());
            snapshots.add(snapshot);
@@ -148,14 +145,14 @@
        order.setStoreLongitude(BigDecimal.valueOf(store.getLongitude()));
        order.setStoreLatitude(BigDecimal.valueOf(store.getLatitude()));
        order.setOrderDescribe(DESCRIBE + submit.getStoreId());
        order.setOriginalPrice(amount);
        order.setPaidPrice(amount);
        order.setActuallyPayPrice(amount);
        order.setOriginalPrice(info.getAmount());
        order.setPaidPrice(BigDecimalUtils.subtract(info.getAmount(), info.getPromotionAmount()));
        order.setActuallyPayPrice(info.getPayAmount());
        order.setOpenid(openid);
        order.setPayType(submit.getPayType().getKey());
        order.setExpireTime(expire);
        order.setOpenid(openid);
        Long total = BigDecimalUtils.yuanToCents(amount);
        Long total = BigDecimalUtils.yuanToCents(info.getAmount());
        if (total > 0) {
            HwcResponse response = swiftPassService.pay(StringUtils.getIp(request), total.toString(), expire,
                    DESCRIBE + submit.getStoreId(), openid, orderNum, submit.getPayType());
@@ -248,11 +245,15 @@
        OrderInfo info = new OrderInfo();
        info.setStore(store);
        info.setProducts(products);
        info.setAmount(amount);
        info.setPayAmount(amount);
        info.setPromotionAmount(BigDecimal.ZERO);
        info.setDeliveryPrice(store.getDeliveryFee());
        info.setPackagingPrice(BigDecimalUtils.multiply(store.getPackagingFee(), count));
        BigDecimal packagingPrice = BigDecimalUtils.multiply(store.getPackagingFee(), count);
        info.setPackagingPrice(packagingPrice);
        amount = BigDecimalUtils.add(amount, packagingPrice);
        amount = BigDecimalUtils.add(amount, store.getDeliveryFee());
        info.setAmount(amount);
        info.setPayAmount(amount);
        info.setUserAddresses(userAddressService.queryUserAddress(store.getLongitude(), store.getLatitude()));
        return info;
    }