package cn.van.business.controller.jd;

import cn.van.business.filter.RequireAuth;
import cn.van.business.model.ApiResponse;
import cn.van.business.model.jd.ProductOrder;
import cn.van.business.mq.MessageProducerService;
import cn.van.business.repository.ProductOrderRepository;
import cn.van.business.util.JDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author Leo
 * @version 1.0
 * @create 2024/11/7 13:39
 * @description：
 */
@RestController
@RequestMapping("/recordOrder")
@RequireAuth
public class OrderController {

    public static String TOKEN = "dd7f298cc465e7a9791796ae1303a1f6c031a18d4894ecd9e75d44fdb0ef32d80a49e4c5811b98d8ac65d73d22a54083630d5329c7c9de2276317669ecb2e544";
    @Autowired
    private MessageProducerService messageProducerService;
    @Autowired
    private ProductOrderRepository productOrderRepository;

    @RequestMapping("/list")
    @ResponseBody
    public ApiResponse list() throws Exception {
        try {

            List<ProductOrder> all = productOrderRepository.findAll();
            return ApiResponse.success(all);
        } catch (Exception e) {
            return ApiResponse.error(500, "Server Error: " + e.getMessage());
        }
    }

}
