| | |
| | | } |
| | | // 订单号 |
| | | String orderNum = redisUtils.generateSn(ORDER_KEY, GenerateEnum.ORDER.getKey()); |
| | | // 总金额 |
| | | BigDecimal amount = BigDecimal.ZERO; |
| | | // 商品快照 |
| | | List<OrderProductSnapshot> snapshots = new ArrayList<>(); |
| | | for (ProductInfo productInfo : info.getProducts()) { |
| | |
| | | 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); |
| | |
| | | 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()); |
| | |
| | | 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()); |
| | |
| | | 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; |
| | | } |