xin
2025-09-15 19dd09c5bebbc19f30da1e2a0959a474568ed311
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
@@ -57,6 +57,7 @@
    private static final String DESCRIBE = "哦应:";
    private static final String ORDER_KEY = "oying:order";
    private static final String ORDER_STORE_KEY = "oying:order:store";
    private static final String ORDER_CODE = "ORDER";
    @Override
    public PageResult<Order> queryAll(OrderQueryCriteria criteria, Page<Object> page) {
@@ -95,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()) {
@@ -115,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);
@@ -138,6 +136,7 @@
        order.setOrderTime(submit.getDateTime());
        order.setSendPrice(store.getDeliveryFee());
        order.setSendType(SendTypeEnum.LY.getKey());
        order.setPackagingPrice(info.getPackagingPrice());
        order.setUserId(SecurityUtils.getCurrentUserId());
        order.setUsername(SecurityUtils.getCurrentUsername());
        order.setStoreId(submit.getStoreId());
@@ -147,14 +146,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());
@@ -247,11 +246,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;
    }
@@ -267,7 +270,7 @@
    public OrderResponse getByOrderNum(String orderNum) {
        return new OrderResponse(orderMapper.getByOrderNum(orderNum),
                addressSnapshotService.queryByOrderNum(orderNum),
                operationLogService.getByOrderNum(orderNum, null));
                operationLogService.getByOrderNum(orderNum, ORDER_CODE));
    }
    @Override