package com.ruoyi.database.service;
import java.util.Date;

import com.ruoyi.database.domain.Order;
import com.ruoyi.database.domain.ParkingBillInfo;
import com.ruoyi.database.domain.ParkingBillPaymentInfo;
import com.ruoyi.database.domain.PayFees;
import com.ruoyi.database.enums.OrderStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
@RequiredArgsConstructor
public class OrderService {

    private final ParkingBillPaymentInfoService parkingBillPaymentInfoService;
    private final ParkingBillInfoService parkingBillInfoService;

    /**
     * 创建订单
     */
    public void createOrder(PayFees payFees) {
        ParkingBillInfo one = parkingBillInfoService.lambdaQuery()
                .eq(ParkingBillInfo::getBillCode, payFees.getBillCode())
                .last("limit 1")
                .one();
        if (one == null) {
            throw new RuntimeException("未查询到订单");
        }
        System.out.println("收到创建支付订单请求: orderId=" + payFees.getBillCode() +
                ", amount=" + one.getTotalCostYuan());
//        ParkingBillPaymentInfo parkingBillPaymentInfo = new ParkingBillPaymentInfo();
//        parkingBillPaymentInfo.setBillCode(payFees.getBillCode());
//        parkingBillPaymentInfo.setPlateNo(one.getPlateNo());
//        parkingBillPaymentInfo.setPlateColor(one.getPlateColor());
//        parkingBillPaymentInfo.setOpenId("");
//        parkingBillPaymentInfo.setAlipayUserId("");
//        parkingBillPaymentInfo.setPhone();
//        parkingBillPaymentInfo.setPayStatus(0);


//        orderCache.put(orderId, order);


    }

}
