| | |
| | | import com.oying.modules.hwc.service.SwiftPassService; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.domain.enums.ProductStatusEnum; |
| | | import com.oying.modules.pc.product.service.ProductInventoryService; |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.domain.enums.StoreStatusEnum; |
| | |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.domain.vo.ProductInfo; |
| | | import com.oying.modules.sh.service.*; |
| | | import com.oying.service.PayConfigService; |
| | | import com.oying.utils.*; |
| | | import com.oying.utils.enums.*; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.sh.domain.dto.OrderQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderMapper; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private final RedisUtils redisUtils; |
| | | private final StoreService storeService; |
| | | private final OrderOperationLogService operationLogService; |
| | | private final ProductInventoryService productInventoryService; |
| | | private final PayConfigService payConfigService; |
| | | @Value("${oying.enabled}") |
| | | private Boolean oyingEnabled; |
| | | private static final String DESCRIBE = "哦应:"; |
| | | private static final String ORDER_KEY = "oying:order"; |
| | | private static final String ORDER_STORE_KEY = "oying:order:store"; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized Order submitOrder(SubmitOrder submit, HttpServletRequest request) { |
| | | submit.setPayType(payConfigService.findInfo(oyingEnabled)); |
| | | switch (submit.getPayType()) { |
| | | case HWC: |
| | | case HWC2: |
| | | case HWC3: |
| | | break; |
| | | default: |
| | | throw new BadRequestException("支付类型暂未开放"); |
| | |
| | | List<OrderProductSnapshot> snapshots = new ArrayList<>(); |
| | | for (ProductInfo productInfo : info.getProducts()) { |
| | | Product product = productInfo.getProduct(); |
| | | productInventoryService.decreaseStock(product.getProductId(), productInfo.getCount()); |
| | | OrderProductSnapshot snapshot = new OrderProductSnapshot(); |
| | | snapshot.setOrderNum(orderNum); |
| | | snapshot.setStoreId(submit.getStoreId()); |
| | |
| | | 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()); |
| | |
| | | switch (anEnum) { |
| | | case HWC: |
| | | case HWC2: |
| | | case HWC3: |
| | | JSONObject object = swiftPassService.query(orderNum, anEnum); |
| | | if (!object.getString("trade_state").equals(PayStateEnum.NOTPAY.getKey())) { |
| | | throw new BadRequestException(PayStateEnum.getValue(order.getPayState())); |